The attempted operation is prohibited because it exceeds the list view threshold enforced by the administrator

I got this error while trying to retrieve items from a SharePoint list using the SharePoint server object model. The full error message is “The attempted operation is prohibited because it exceeds the list view threshold enforced by the administrator”.

By default, SharePoint has a threshold limit of 5000 items. If the list grows further then it will give a performance issue. If you are trying to query items from a very larger list then you may face this issue.

The attempted operation is prohibited because it exceeds the list view threshold enforced by the administrator SharePoint

To resolve the issue you can set EnableThrottling = false; for the particular list before retrieving.

using (SPSite thisSite = new SPSite(ServerInfo.SharePointListUrl.ToString()))
{
using (SPWeb web = thisSite.OpenWeb())
{
SPList listCountry = web.Lists["Country"];
listCountry.EnableThrottling = false;
SPQuery objquery = new SPQuery();
objquery.Query = "<Where><Eq><FieldRef Name=’Country’ /><Value Type=’Text’>India</Value></Eq></Where>";
SPListItemCollection items = listCountry.GetItems(objquery);
}
}

Now, you can try to retrieve more items, it will not throw any error.

You may like following SharePoint tutorials:

This tutorial helped us to fix the error, The attempted operation is prohibited because it exceeds the list view threshold enforced by the administrator which comes while retrieving more than 5000 items using the SharePoint server object model.

Donwload Hub site pdf

Download SharePoint Online Tutorial PDF FREE!

Get update on Webinars, video tutorials, training courses etc.

>