Folders in Lists/Libraries are a common tool used for creating hierarchy and structure in SharePoint. They allow us to organize documents and items in a manner that the end user is both familiar and comfortable with.
The question comes up then, when having to work with the documents in Nintex Workflow when dealing with Folders, how do we search an entire library for a specific document (or whatever other filter may apply)?
Well, if you’re querying the a list on the current site, it’s as easy as selecting the checkbox labelled ‘Recursive’ through the action’s UI. (See note at end below about ‘RecursiveAll’ for searching SubFolders)
The difficulty is when you are attempting to perform this functionality through the CAML editor. You’ll note that the Recursive label/checkbox has disappeared, this is a problem if you need to perform this query on an alternative site.
The good news is that there is a simple fix, you just need to add the following line of XML to the CAML Query before the ending Query tag:
It’s as simple as that, the Query List action will now search through all folders at the root level of the list/library.
Note: if you’re wanting to query more than just the top level folders, change the Scope defined in the View Attributes to ‘RecursiveAll’