Skip to main content

In SP 2016, I have a Nintex workflow that needs to convert a library name (input by a user) into list GUID. This GUID will be used in CAML query. 

 

How can I retrieve the GUID of a list/library?

 

Many thanks.

 

Mayank

I'm not sure if this will answer your question with an acceptable work around but I assume that you want the GUID so that you can make your CAML query against the ID attribute of the list in question, like: 



<List ID="{BLAH-BLAH-BLAH-BLAH}" />

 



However, if you use the Title attribute instead, you should be able to use the user's input string directly, like:



<Query>

<Lists>

<List Title="Your Library List Here" />

</Lists>

<ViewFields>

<FieldRef Name="ID" />

</ViewFields>

<Where>

<IsNotNull>

<FieldRef Name="Title" />

</IsNotNull>

</Where>

</Query>





 



 



Hope this helps! 


Thank you. That helped a lot.

it's a very helpful thing to know, but for whatever reason I don't see people often writing out their CAML Queries in this way. I suspect because the GUID is immutable, so in that sense, more reliable than using a standard string. However I feel like no matter what you need to do error checking to make sure that you were able to complete the query any way, so it seems like the same amount of work to me! 

Good to hear that it helped you in this case! 


Sorry for bumping this up, but I have a question relating to this. I want to retrieve the data from a certain list column through the CAML editor, but the CAML editor references Sharepoints internal column names, not their display names. I know how to find the internal name manually, but when I have the column (display) name as a workflow variable, do you know if you can do a similar trick as using List Title instead of the List ID for the column names to use the display name rather than the internal name?


Reply