Working/Crawling With Large Lists In SharePoint 2010 – List Throttling

Posted: November 7, 2014 in SharePoint2010

Introduction

In order to retrieve any information using the object model along with retrieving 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

Even if we are updating approximately 20+ lookup Columns and some issue arises, it can be resolved using:

“ThrottleOption”…

using (SPSite theSite = new SPSite(SPContext.Current.Site.Url))

{

using (SPWeb theWeb = theSite.RootWeb)

{

SPList theList = theWeb.Lists[“My List Name”];

SPQuery qry = new SPQuery();

qry.QueryThrottleMode = SPQueryThrottleOption.Override;

//set the Query property as needed to retrieve your data

SPListItemCollection coll = theList.GetItems(qry);

qry.ViewAttributes = “Scope=\”Recursive\””;

qry.ViewFields = “<FieldRef Name=’Title’/>”;

qry.RowLimit = 1000;

SPListItemCollection coll = theList.GetItems(qry);

}

}

Now that you know what the properties are all about, let’s talk about the ways in which you can use them. Assume the following scenario:

· # of items: 3000
· EnableThrottling property: true
· Default view: display items in batches of 3000
· List View Threshold property: 2500
· List View Threshold for Auditors and Administrators : 2800
· Object Model Override : Yes
· Method for OM Query: SPQuery with QueryThrottleMode = Override, query retrieves all items.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s