1

I want to search for every single item within a document library. This is working just fine, but isn't working if the files within a document set in that library.

I'm using an empty CAML query because I'm trying to get all list items within document library which is working just fine. Just not within document sets.

How can I make this CAML recursively search through document sets?

private static ListItemCollection GetListItems(List docLibrary, ClientContext ctx)
        {
            CamlQuery query = new CamlQuery();
            Console.WriteLine();

            var listItems = docLibrary.GetItems(query);
            ctx.Load(listItems);
            ctx.ExecuteQuery();
            return listItems;
        }
2

Document sets are just "fanzy" folders, so you have to use scope RecursiveAll.

query.ViewXml = "<View Scope=\"RecursiveAll\" /> ";

Or simply use the CreateAllItemsQuery that sets the same caml markup:

CamlQuery query = CamlQuery.CreateAllItemsQuery();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.