在 SharePoint 2010 中动态构建 CAML 查询
我需要根据 ItemID 从列表中获取项目。我有一个包含 5000 个项目的列表,其中我仅检索 1000 个项目,为此我将使用 JohnHoliday CAML.NET 动态构建 CAML 查询,并且该查询有 1000 个条件当时我得到了值不在预期范围内错误。该查询最多可以处理 150 个项目,但当 ItemID 增加时会抛出错误。您能为这个问题提供合适的解决方法吗?
I have an requirement of get the items from the list depends on the ItemID.I have list which contains 5000 items in which I retrieve only 1000 items for that I will dynamically build the CAML query using JohnHoliday CAML.NET and the query have 1000 conditions at that time I got Value does not fall within the Expected Range error. The query works fine upto 150 items but it throws error when the ItemID increases.Could you provide a suitable workaround for this issue ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您遇到了 CAML 查询的大小限制,据我所知,该限制在任何地方都没有记录,但确实存在。
如果您只需要支持 2010,那么您可以使用新的运营商可能会让您进一步出价
You're running into the size limit for CAML queries, which AFAIK isn't documented anywhere, but definitly exists.
If you only need to support 2010 then you can use the new <In> operator which probably with get you a bid further
在 sharepoint 2010 中,有一个列表视图阈值配置,使管理员能够确定在一个补丁中可以检索的最大项目数
为了解决这个问题,你可以使用
内容迭代器
查看此链接获取更多帮助
In sharepoint 2010 there is a List view threshold configuration that give the administrator the ability to determine the maximum items you can retreive in a one patch
and to overcome this problem you can use
ContentIterator
check this link for more help
为什么不迭代 SPList.Items 并获取您需要的项目?因此无需构建复杂的 caml 查询。或者调用 SPList.GetItemByUniqueId。
Why not iterate over SPList.Items and take which items you need? So there's no need to build a complex caml query. Or call SPList.GetItemByUniqueId.