我在查询SharePoint列表时遇到错误,列表有5005条记录,阈值限制为5000.我有一个包含不同文件夹的sharepoint列表,我正在使用带有RecursiveAll的CAML查询来获取所有文件夹中的记录 . 我收到这个错误: -
禁止尝试操作,因为它超出了管理员强制执行的列表视图阈值 . 在Microsoft.SharePoint.Client.ClientRequest.ProcessResponse()的Microsoft.SharePoint.Client.ClientRequest.ProcessResponseStream(Stream responseStream)处
我的疑问是
"<View Scope='RecursiveAll'> <RowLimit>1000</RowLimit><Query><Where><Eq><FieldRef Name='Year' /><Value Type='Text'>" + Period + "</Value></Eq></Where></Query></View>";
年是索引列 . 如果我删除where子句,它开始工作 . 在我看来 recursiveall
不使用 where
子句 .
I don't want to change list threshold limit.
2 回答
列表的默认阈值为5000.您需要将此列表的SharePoint配置设置更改为具有更高的阈值 . 不确定您所使用的SharePoint版本,但是您是否可以访问Central Admin here is an article explaining how to change it .
如果您使用的是SharePoint Online,我认为您可能会被卡住,but one of these answers has a supposed work around for it .
要解决此问题,您需要使用ContentIterator . 基本上你是分批分解查询,例如2000项 . 来自Microsoft网站:
有关官方文档,请参阅here .
这example也可能有所帮助 .