简体   繁体   English

Sharepoint 的 CAML 查询问题

[英]Issue with the CAML query with Sharepoint

I am trying to get the list of files from sharepoint folder and subfolders using the CAML query.我正在尝试使用 CAML 查询从共享点文件夹和子文件夹中获取文件列表。 i have been trying to use the RecursiveAll as view scope.我一直在尝试使用 RecursiveAll 作为视图范围。 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.请让我知道,如果有任何其他方式,如果 RecursiveAll 无法获取所有文件。

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.请尝试使用小于 5000 的行限制以查看它是否有效,这可能会触发 Microsoft 为优化 SharePoint Online 环境查询性能而施加的列表视图阈值限制。 However, for SharePoint On-Prem this limit can be configured but not recommended for optimal performance.但是,对于 SharePoint On-Prem,可以配置此限制,但不建议为获得最佳性能。 And make sure that, columns in where clause are all indexed.并确保 where 子句中的列都已编入索引。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM