Reputation: 11
I am trying to get the list of files from sharepoint folder and subfolders using the CAML query. i have been trying to use the RecursiveAll as view scope. but no luck.
Code:
request.AddParameter("application/json;odata=verbose", "{'query':{ '__metadata':{'type':'SP.CamlQuery'},'ViewXml':'<View><Query><RowLimit>8800</RowLimit></top>" + viewQueryData.ViewQuery + "<QueryOptions><ViewAttributes Scope=\"RecursiveAll\"/></QueryOptions></Query></View>'}}", ParameterType.RequestBody);
Generated query:
<View Scope="RecursiveAll"><Query><Where><And><And><And><Or><Eq><FieldRef Name="Document_x0020_Type" /><Value Type="Text">Workbook</Value></Eq><Eq><FieldRef Name="Document_x0020_Type" /><Value Type="Text">Standalone Scorecard</Value></Eq></Or><Neq><FieldRef Name="CR_x0020_Upload_x0020_Status" /><Value Type="Text">Complete</Value></Neq></And><Neq><FieldRef Name="CR_x0020_Upload_x0020_Status" /><Value Type="Text">Not Required</Value></Neq></And><Eq><FieldRef Name="Document_x0020_Status" /><Value Type="Text">Approved</Value></Eq></And></Where></Query></View>
Can someone help me, if i am missing anything here? please let me know, if there is any other way, if the RecursiveAll is failing to get all the files.
Upvotes: 1
Views: 448
Reputation: 1467
Please try with Row limit less than 5000 just to see if it works, this might be triggering List view threshold limit imposed by Microsoft for optimal performance of queries for SharePoint Online environment. However, for SharePoint On-Prem this limit can be configured but not recommended for optimal performance. And make sure that, columns in where clause are all indexed.
Upvotes: 0