开发者

Server timeout issue when getting a large amount (500000) of records from a SharePoint 2010 list

I am working in SharePoint 2010, I want to get 500000 "Announcement" list items from the curren开发者_JS百科t spweb. I have a server timeout issue and the code is given below.

SPList list = web.Lists["Announcements"];
SPQuery query= new SPQuery();
query.Query = "<Where><And><Geq><FieldRef Name=\"ID\" /><Value Type=\"Counter\"> 1</Value></Geq><Leq><FieldRef Name=\"ID\" /><Value Type=\"Counter\">500000 </Value></Leq></And></Where>";
query.RowLimit = 500000;
SPListItemCollection items = list.GetItems(query);
DataTable dt = items.GetDataTable(); //Here I get the timeout error.

How do I resolve this issue?


SharePoint's best practices clearly state that no more than about 2000 rows should be in a view.

Best Practices also state that pulling list items programatically should be limited to about 10,000 rows at a time.

Here is a good article to help set reasonable limits for lists:

http://sharepointsearch.com/cs/blogs/notorioustech/archive/2009/04/08/best-practices-for-large-sharepoint-lists-and-documents-libraries.aspx

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜