In this post titled "How to change the List View Threshold and Other Resource Throttling Settings", I described why you might want to use the "List View Threshold for Auditors and Administrators", which is 20,000 by default. This limit is higher than the default 5,000 List View Threshold that gets applied to all regular users. If you decide you do want to use this higher limit for some custom code or application, then the following conditions must all be met:
If any of those conditions are not met, then the query will be subject to the regular List View Threshold, rather than the Auditor/Administrator one which is typically higher.
In this post, I'll describe how to go about doing this:
First, you have to make sure your Object Model Override is enabled (It is ON by default, so unless you've changed it, you are fine).
Next, you'll need to grant sufficient privileges to the account that will perform these queries ("Full Control" or "Full Read"). Here's how to do that:
In Central Admin:
- Click “Application Management”
- Click “Managed Web Applications”
- After selecting a specific Web Application, click “User Policy” in the Ribbon
- Click “Add Users”
- Select Zone (default: All Zones)
- Enter Permission level (either of these will suffice)
o Full Control
o Full Read
Optionally, you may want to consider changing the List View Threshold for Auditors or Administrators to a different number. For example, if you know you don't need all 20,000, then it would be a good idea to lower that number to make sure custom code does not accidentally get written inefficiently without being noticed.
Now you're ready to use the List View Threshold for Auditors and Administrators. To do so, running as that user will "Full Control" or "Full Read", you will need to run code that looks something like this:
SPQuery q1 = new SPQuery();
q1.QueryThrottleMode = SPQueryThrottleOption.Override;
There are 3 different options for SPQueryThrottleOption:
Thanks for reading, please let me know if you have any questions.
Program Manager on SharePoint, MSFT.
Thanks for your post. I have a one question, How can I modify views columns ( for eg. I want to check show all items in this view), is there a way to check that?
Sorry puru, I don't understand the question. To modify a view's columns you use the list or library tab in the ribbon, then modify view, where you should be able to specify the columns and the items to show in the view.
Thanks for your response. Using object model can I check "show all items in this view" (Which is in Filter section) in Discussion List. By default its unchecked. so , I want to check that radio button using SP object model. Hope that you can help me.
I think the UI will select “Show all items in this view” when the <Where> is empty or missing in the view definition. If that’s correct, then the answer is “modify SPView.Query so that the <Where> is empty, or to remove <Where> from it.”
You should double-check the statement “by default it’s unchecked” though, since last I checked, the OOB Discussion Board views had no filters.
Let me know if that helps.
We are using web services to access SharePoint from our client application. Can this be used for client applications via either web services or Client Object Model?
Am also trying to access via Web Services. To my knowledge, It's not possible to specify QueryThrottleMode in Web Service Call. Because we are just passing Query as XML.
So I've changed my code to use pagination and retrieve list items as Batches(2000 each call).
Add below code where ur getting results. This string has next page pointer.
listNextPagePointer = listItem.ChildNodes.Attributes["ListItemCollectionPositionNext"].Value;
In WebService call add below code.
XmlNode ndQueryOptions = xmlDoc.CreateNode(XmlNodeType.Element, "QueryOptions", "");
nextPagePointer = "<Paging ListItemCollectionPositionNext='" + listNextPagePointer + "' />";
nextPagePointer = nextPagePointer.Replace("&", "&");
ndQueryOptions.InnerXml = nextPagePointer;
listViewNode = ls.GetListItems(listName, null, ndQuery, ndViewFields, ListRowLimit.ToString(), ndQueryOptions, null);
I have a list in production with 30,000 + items . i want to filter records , but the filter is not working .User should be able to rearch records in the first 100 or may be the last 100 of the 30000 records please help
Thank you for sharing this.
Enabling ""Full Control" or "Full Read" to users does that mean they have such permissions for the whole webapplication?
We are created a custom webpart that filters a huge list (25.000 items and more). The users that wants to view the data are not supposed to have this kind of permissions.
thanks, it seems only object model is the way to change the SPQueryThrottleOptions