gpt4 book ai didi

c# - Sharepoint 列表 caml 查询问题,因为它超过了阈值限制

转载 作者:行者123 更新时间:2023-11-30 16:42:45 25 4
gpt4 key购买 nike

我在查询 SharePoint 列表时出现以下错误,列表有 5005 条记录,阈值限制为 5000。我有一个包含不同文件夹的共享点列表,我正在使用 CAML 查询和 RecursiveAll 从所有文件夹中获取记录。我收到此错误:-

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

我的查询是

"<View Scope='RecursiveAll'> <RowLimit>1000</RowLimit><Query><Where><Eq><FieldRef Name='Year' /><Value Type='Text'>" + Period + "</Value></Eq></Where></Query></View>";

年份是索引列。如果我删除 where 子句,它开始工作。在我看来 recursiveall 不适用于 where 子句。

我不想更改列表阈值限制。

最佳答案

要解决这个问题,您需要使用 ContentIterator。本质上,您正在分批分解查询,例如2000 项。来自微软网站:

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. ContentIterator implements a callback pattern for segmenting the query for processing a single item at a time. 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.

有关官方文档,请参阅 here .

example也可能有所帮助。

关于c# - Sharepoint 列表 caml 查询问题,因为它超过了阈值限制,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46118969/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com