SharePoint 2010 Query Thresholds Bite You When You Least Expect It

In a previous post, Understanding List Query Throttling Limits in SharePoint 2010, I talked about how SharePoint 2010 applies query throttling to list queries and how you can work around the query thresholds. In this post I just wanted to add how list query thresholds can cause errors when you least expect it.

Today I was trying to export a SharePoint team site as a WSP. The Save site as template operation kept failing with an unexpected error. I took a look at the event logs, and found the following exception message:

Error exporting the list named "BigList" at the URL: Lists/BigList

"Fine", I thought to myself. I'm not particularly interested in that list, I'll simply delete it. I tried to delete the list and got hit with another runtime error. This time the event logs were more helpful:

Exception type: SPQueryThrottledException
Exception message: The attempted operation is prohibited because it exceeds the list view threshold enforced by the administrator.

Now things were starting to make more sense. The list I was trying to export, and then trying to delete, contains 10,000 items. Even though I'm not explicitly trying to retrieve all 10,000 items, both the export operation and the delete operation will hit all 10,000 rows in the database. The list view threshold is kicking in and blocking the operation.

"Fine", I thought to myself again. I'll grant myself full control permissions in the Web application user policy, thereby giving myself the higher auditors and administrators threshold for list operations. Wrong again. As I pointed out in my earlier post, the higher threshold only applies to programmatic queries in which you explicitly invoke the object model override. I was still unable to delete the list through the UI.

So how did I finally get rid of the large and unwanted list? I remembered that local server administrators are exempted from list view thresholds by default. I opened up a PowerShell window, using the local server administrator account, and ran a few cmdlets to delete the list once and for all.

$site = get-spsite http://mysiteurl
$web = $site.rootweb
$list = $web.lists["BigList"]

And the list was gone. If you plan on creating large lists on your SharePoint 2010 sites, it's worth bearing in mind that they're not quite so straightforward to export, move or get rid of once you're finished with them.


  1. Good one. I have a similar problem. Was able to go in, reduce the number of limit of items. Delete items from that view. Eventually, delete the list itself.


Post a Comment

Popular posts from this blog

The target principal name is incorrect. Cannot generate SSPI context.

Server-side activities have been updated

Versioning SharePoint Framework Packages