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

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. 

Ebook Download
View all
Learn
View all