0

Can you please help with the following question. I have a document library with a lot of documents (>5000) which are organized in subfolders. I have to query all documents in subfolder. I use this query:

"<View Scope=\"RecursiveAll\"> " +
     "<OrderBy><FieldRef Name='ID' Ascending='False' /></OrderBy>" + 
     "<Where>" +
           "<Eq>" +
                    "<FieldRef Name='FileDirRef' />" +
                    "<Value Type='Text'>{0}</Value>" +
           "</Eq>" +
     "</Where>" +
"<ViewFields>" +
   "<FieldRef Name='ID'/>" +
   "<FieldRef Name='FSObjType'/>" +
   "<FieldRef Name='FileLeafRef'/>" +
   "<FieldRef Name='FileRef'/>" +
"</ViewFields>" +
"<RowLimit>50</RowLimit>" +"</View>";

The problem is that even subfolder is presented in Where filter this query returns every time 50 items from other subfolders also. It seems that subfolder just ignored and every time 50 items are returned. I tried to set FolderServerRelativeUrl for camlquery object like this:

var query = new CamlQuery
            {
                ViewXml = String.Format(AssignDocuments.GetAllFilesAndSubfoldersQuery, folderUrl),
                FolderServerRelativeUrl = folderUrl
            };

But in this case Exception threshold is reached is thrown.

0

You don't need to set the FolderServerRelativeUrl if you are already including FileDirRef in your CAML. Remove the FolderServerRelativeUrl property.

| improve this answer | |

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