开发者

Dynamically building CAML query in SharePoint 2010

I have an requirement of get the items from the list开发者_如何学Python 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 ?


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


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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜