SharePoint 2010 has a number of new features centered around working with large lists. A new feature incorporated into SharePoint 2010 for putting limit on the amount of data to be retrieved from the servers. The feature is called List Throttling.
SP2010 can support up to 50 million items in a list now, but you don’t obviously want to return all of those in a single query. To aid with this, SP2010 introduces list throttling settings (configured at the web application level), that allow you to specify how many items a user can query before the throttle kicks in and aborts the query. At the time of writing, these limits are set to 5,000 for normal users and 20,000 for super users. Remember you can change these settings if you so choose. I’ll be curious to see what numbers people actually end up running with. This applies to anything that queries the list whether its through the SharePoint UI or from your own custom code. If the user submits a query that is too large, the SharePoint UI will tell the user that the query is too big and they need to filter it.
List throttling is managed through web application. Click on Application Management --> Manage Web Applications. Select the web application you want to configure list throttling, then in the ribbon click on the General Settings drop down and select the Resource Throttling item. Below figure shows how to enable list throttling in a web application.
In order to retrieve information using the object model in order to retrieve up to the number of items specified in the List query size threshold for auditors and administrators property, there is a property you need to set in your query object.
The property is called QueryThrottleMode and it applies to the SPQuery andSPSiteDataQuery classes. You simply set this property to override and then use your class instance to query.
The property is called QueryThrottleMode and it applies to the SPQuery andSPSiteDataQuery classes. You simply set this property to override and then use your class instance to query.
using (SPSite oSite = new SPSite("http://sp2010:1234"))
{
using (SPWeb oWeb = oSite.RootWeb)
{
SPList oList = oWeb.Lists["Test List"];
SPQuery oQuery = new SPQuery();
oQuery.QueryThrottleMode = SPQueryThrottleOption.Override;
SPListItemCollection oListColl = oList.GetItems(oQuery);
//Your custom logic here for processed data
}
}
No comments:
Post a Comment