ShareMaster V2 is in beta, a complete rebuild. See what is new and request access →
Features All features overview
Migration Tools Overview Structure and content OneDrive ↔ SharePoint Content only Structure only Move / Copy Upload from this computer Download to this computer Dropbox to SharePoint Resume and incremental runs
Recycling Bin Overview Browse a site's recycle bin Empty recycle bins in bulk Restore and purge history
Archive Overview Configure the tenant On Demand Archive Restore Archived Files Archive Savings Report Blob Viewer
Optimise Storage Tools Overview Delete all items in a list Delete all files and folders in a library Remove empty folders Remove duplicate files Reduce image sizes Delete sites and subsites
SharePoint Tools Overview Tenant Explorer SharePoint Explorer Easy Settings Fix renamed groups List Explorer Search the Preservation Hold Library
Replace Overview Replace in SharePoint Replace in local files Find password-protected files
Shared Links Overview Report shared links Report unique permissions Remove a person from sharing links Remove shared links Remove unique permissions
Version History Overview Version trimming Version trimming report Reset file version
Reports Overview Inventory report Folder inventory Site and subsite storage Security matrix Teams permissions Pre-migration analysis Compare items Dropbox to Microsoft 365 compare Duplicate file report Empty folder report Image size report Recycle bin report Unused licences Report history
V2 beta Pricing Demos Blog Guides Use cases Compare Tools Alerts FAQ Contact Sign in Start free trial
  1. Home
  2. Guides
  3. Delete a Large Library

"The attempted operation is prohibited because it exceeds the list view threshold" when deleting a library

You went to Site contents, chose Delete on an old document library, confirmed, and SharePoint came back with this:

SharePoint Online notification: 1 item wasn't deleted. Projects. The attempted operation is prohibited because it exceeds the list view threshold.
Deleting a library called Projects from Site contents in SharePoint Online.
1 item wasn't deleted
The attempted operation is prohibited because it exceeds the list view threshold.

The library is still there, with every file in it. Nothing you can click in the browser will change that while the library is that big. The way through is to empty it first and delete the empty shell afterwards.

Why a library can be too big to delete

SharePoint Online caps how many items one database operation may process at a time. That cap is the list view threshold, and Microsoft sets it at 5,000. Deleting a library is a single operation over everything inside it, so once a library holds more than the threshold allows, the request is refused and you get the notification above. The "1 item" in the message is the library itself, not a file.

Two things people try first, and why neither helps:

  • Raising the threshold. Not possible in SharePoint Online. Microsoft documents it as fixed so everyone sharing the service keeps fast queries.
  • Waiting for the daily time window. That is an off-peak override an administrator configures in SharePoint Server, on-premises. Microsoft 365 has no equivalent.

Selecting everything in the library view and pressing Delete does not get far either. The browser only selects what it has loaded, so on a library with tens of thousands of documents you are back to deleting a few hundred at a time, for days.

The same rule bites other tools. The PnP PowerShell Remove-PnPList cmdlet hits the identical error on a library over the threshold, because it asks SharePoint for exactly the same thing the Delete button does.

Empty it with ShareMaster Bulk Delete, then delete the library

ShareMaster's Space Master includes Bulk Delete File & Items. It reads the library 2,000 items per page and removes each file and folder with its own request, so no single operation ever comes near the threshold. When the library is empty, the normal Delete in Site contents works.

  1. Open ShareMaster, go to Optimize Storage (Space Master) and choose Bulk Delete File & Items.
  2. Connect to the site and pick the library you want gone.
  3. Leave both date boxes (Exclude files and items created after and Exclude files and items modified after) empty. You want everything.
  4. Tick Include folder removal as well. Without it, the files go but the folder tree stays behind, and that can still be enough items to keep the library over the threshold.
  5. Leave Send to recycling bin ticked. If the wrong library was picked you can still restore from the bin. Untick it only when you are certain and want the items purged straight away.
  6. Start the run and let it work. Each removed item shows in the run log, and anything SharePoint refuses, such as a file someone has checked out, is listed as an error with the reason.
  7. When it finishes, run it once more. It reads whatever is still in the library, so a second pass mops up the stragglers.
  8. Go to Site contents, open the menu on the library and choose Delete. It goes this time.

Expect it to take 24 hours or more. Run it over the weekend.

This is the part to plan for.

Because ShareMaster deletes files and folders individually instead of in one sweep, the time grows with the item count. Folders are removed one call at a time so that a folder already removed along with its parent does not stop the run. SharePoint also slows down any account that sends a lot of requests, and the tool waits out that throttling rather than failing. On a library with hundreds of thousands of documents, 24 hours or longer is normal.

So start it on Friday afternoon and let it run through the weekend. A few practical points:

  • Use a machine that will stay on. Turn off sleep in the Windows power settings for the duration, or the run pauses when the PC does.
  • Fewer people are working in the site, so you are less likely to hit files that are open or checked out.
  • If the run does stop, start it again. It picks up what is left in the library rather than starting from a full count.

Then get the storage back

With Send to recycling bin ticked, every file lands in the site's recycle bin and still counts against your storage quota. The space is not returned until the first-stage and second-stage bins are both cleared, or until the items age out after 93 days. Once you are sure nothing needs restoring, empty both stages from the site's Recycle bin page, or use Recycle Master to clear the bins of several site collections in one job. The bulk delete files guide walks through both stages.

The script route, if you would rather

The Microsoft 365 PnP community publishes a PowerShell sample built on the same idea: remove the files, remove the folders, then remove the library. It works, but you need PnP PowerShell installed and registered against your tenant, the sample removes files without sending them to the recycle bin, and if the session drops halfway through a long run, the retries and the restart are yours to handle. ShareMaster does the same job with a progress log, a recycle bin safety net and no script to maintain.

Questions people ask about this error

Does the same error appear when deleting a big folder?

The same rule applies to any single operation that has to touch more items than the threshold, so a very large folder can fail the same way. Bulk Delete can target one folder instead of the whole library: navigate into it before starting the run.

I only see "exceeds the list view threshold enforced by the administrator". Is that different?

Same limit, longer wording. The cause is the 5,000 threshold either way, and so is the fix: get the library under it before you delete.

Will emptying the library lose version history?

With the recycle bin option ticked, each file goes to the bin with its versions and can be restored from there until the bin is emptied. Once both stages are cleared, the files and their history are gone for good.

Got a library that is too big for the browser to delete? Start the Bulk Delete on Friday and come back on Monday to an empty library.

Try ShareMaster free for 14 days