0

Consider the following code, It is querying to a list called Employee Information which has about 23000 items, i.e it has crossed the list view threshold set by the administrator.

 SPListItemCollection collBookings;
                                SPList emp_info =web.Lists.TryGetList("Employee Information");

                                emp_info.EnableThrottling = false;

                                SPQuery query = new SPQuery();

                                query.ViewFields = "<FieldRef Name='Title'/><FieldRef Name='Department' /><FieldRef Name='Author'/><FieldRef Name='Created'/>";

                                query.RowLimit = 1000;
                                do
                                {
                                    query.QueryThrottleMode = SPQueryThrottleOption.Strict;

                                    collBookings = emp_info.GetItems(query);//.GetDataTable();

                                    int it_count = collBookings.Count;
                                    query.ListItemCollectionPosition = collBookings.ListItemCollectionPosition;
                                } while (query.ListItemCollectionPosition != null);

Now in the above code i have used emp_info.EnableThrottling = false;

Now my question is what will this statement exactly do? Will it disable throttling for that list permanently or Will it disable throttling for this particular instance when this code is running?

And also what will happen if i use emp_info.EnableThrottling = true; at the end of this code?

1 Answer 1

1

Setting the SPList.EnableThrottling property to false will disable throttling for a particular list.

It will disable throttling for that list permanently and if you set this to true at the end it will again enalbe it.

There are many other options to deal with throttling issue.

http://adicodes.com/sharepoint-2010-list-throtelling/

http://social.msdn.microsoft.com/Forums/sharepoint/en-US/17266586-5107-45c4-9b60-49288e3698c1/setting-enablethrottling-false-throwing-operation-is-not-valid-due-to-the-current-state-of-the?forum=sharepointdevelopmentprevious

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.