[英]sharepoint list caml query issue because it exceeds threshold limit
I am getting below error while querying SharePoint list,list has 5005 records and threshold limit is 5000. I have a sharepoint list having different folders and i am using CAML query with RecursiveAll to get records from all folders. 我在查询SharePoint列表时遇到以下错误,列表有5005条记录,阈值限制为5000.我有一个包含不同文件夹的sharepoint列表,我正在使用带有RecursiveAll的CAML查询来获取所有文件夹中的记录。 I am getting this error :-
我收到这个错误: -
The attempted operation is prohibited because it exceeds the list view threshold enforced by the administrator.
禁止尝试的操作,因为它超出了管理员强制执行的列表视图阈值。 at Microsoft.SharePoint.Client.ClientRequest.ProcessResponseStream(Stream responseStream) at Microsoft.SharePoint.Client.ClientRequest.ProcessResponse() at
Microsoft.SharePoint.Client.ClientRequest.ProcessResponse()的Microsoft.SharePoint.Client.ClientRequest.ProcessResponseStream(Stream responseStream)处于
My query is 我的疑问是
"<View Scope='RecursiveAll'> <RowLimit>1000</RowLimit><Query><Where><Eq><FieldRef Name='Year' /><Value Type='Text'>" + Period + "</Value></Eq></Where></Query></View>";
Year is indexed column.If i remove where clause,it starts working.It seems to me recursiveall
is not working with where
clause. 年是索引列。如果我删除where子句,它开始工作。在我看来
recursiveall
不使用where
子句。
I don't want to change list threshold limit. 我不想更改列表阈值限制。
The default threshold for a list is 5000. You need to change the SharePoint Configuration settings for this list to have a higher threshold. 列表的默认阈值为5000.您需要更改此列表的SharePoint配置设置以获得更高的阈值。 Not sure what version of SharePoint you are on, but if you can access Central Admin here is an article explaining how to change it .
不确定您使用的是哪个版本的SharePoint,但是如果您可以访问Central Admin,则会有一篇文章解释如何更改它 。
If you are using SharePoint Online, I think you might be stuck, but one of these answers has a supposed work around for it . 如果您使用的是SharePoint Online,我认为您可能会陷入困境, 但其中一个答案可能会解决这个问题 。
To overcome this issue, you will need to use the ContentIterator. 要解决此问题,您需要使用ContentIterator。 Essentially you are breaking up the query in batches of eg 2000 items.
基本上你是分批查询例如2000项。 From the Microsoft website:
来自Microsoft网站:
SharePoint Server provides a new API, ContentIterator, to help with accessing more than 5,000 items in a large list without hitting a list throttling limit and receiving an SPQueryThrottleException.
SharePoint Server提供了一个新的API ContentIterator,可帮助您访问大型列表中的5,000多个项目,而无需达到列表限制限制并接收SPQueryThrottleException。 ContentIterator implements a callback pattern for segmenting the query for processing a single item at a time.
ContentIterator实现了一种回调模式,用于对查询进行分段,以便一次处理单个项目。 Consider using this capability if you need to process a large number of items that may exceed a throttling limit.
如果需要处理可能超出限制限制的大量项目,请考虑使用此功能。 The following trivial example demonstrates the approach used with ContentIterator tested with a list returning 20,001 items from the query.
以下简单的示例演示了使用ContentIterator测试的方法,其中列表返回查询中的20,001个项目。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.