List
Throttling is the new concepts introduced in SharePoint 2010 to set the limits on the
rows of data can be retrieved from a SharePoint list or document library
at one time. Suppose a SharePoint lists contains two thousand records and
someone trying to retrieve all items, then List throttling will not allow
to do so.
Throttling setting will be apply for both views created by the user also for queries executed in custom code also. When executing queries, the number of results returned will be determined by the throttle settings for the given list and the rights of the current user.
Throttling setting will be apply for both views created by the user also for queries executed in custom code also. When executing queries, the number of results returned will be determined by the throttle settings for the given list and the rights of the current user.
You have to set the Throttling settings in the Central Administration.
The default value for this setting is 5,000, which means that results returned from an SPQuery or SPSiteDataQuery object will be generally limited to 5,000 items for both super users and normal users.
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 and SPSiteDataQuery classes. You simply set this property to Override and then use your class instance to query. Here’s a simplified example:
using (SPSite theSite = new SPSite("http://foo"))
using (SPWeb theWeb = theSite.RootWeb)
SPList theList = theWeb.Lists["My List Name"];
SPQuery qry = new SPQuery();
//set the Query property as needed to retrieve your data
SPListItemCollection coll = theList.GetItems(qry);
//do something with the data
}
}
No comments:
Post a Comment