ShareMaster is shaped by your feedback. Tell us what to build next →
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
Microsoft Teams Overview Copy a team Move channels Merge teams Inactive teams Ownerless teams Guests and external access Export a team Search everyone's chats
Recycling Bin Overview Browse a site's recycle bin Empty recycle bins in bulk Restore and purge history Deleted teams
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
Search & Indexing Overview Search query Item search properties Reindex Crawl log
Replace Overview Replace in SharePoint Replace in local files Find password-protected files Remove PDF passwords
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 Storage growth 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 Copilot readiness Inactive sites, OneDrives and groups Orphaned users Site settings Audit activity Groups Checked-out files report Report history
Developer Tools Overview Query Builder PnPjs Console Property Bags SPFx Customizers Webhooks Customisation audit
Pricing Services Demos Blog Guides Use cases Compare Tools Alerts FAQ Contact
  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, then delete the library

ShareMaster's Delete all files & folders in a library tool empties a library in batches that stay far below the threshold, so SharePoint never refuses it. The library itself is kept. Once it is empty, the normal Delete in Site contents works.

  1. Open ShareMaster, go to Optimise Storage Tools and choose Delete all files & folders in a library.
  2. Sign in, pick the site and then the library you want gone.
  3. Leave every filter off: no created-before or modified-before date, no name pattern, no size limit. While any filter is on, folders are left in place, because removing a folder takes everything in it. With no filters, the folders go too.
  4. Leave Permanently delete (skip recycle bin) unticked. Items go to the site recycle bin, so if the wrong library was picked you can still restore them. Tick it only when you are certain and want the space back straight away; you get a red warning to confirm first.
  5. Click Preview (no changes). It counts the files, folders and size it would remove and offers an Excel report, without touching anything.
  6. Click Recycle All and let it run. When it finishes, it tells you how many items went and how many failed. Anything SharePoint refused, such as a file someone has checked out, is listed in the Log tab with the reason.
  7. Sort out any failures and run it again on the same library to pick up what is left.
  8. Go to Site contents, open the menu on the library and choose Delete. It goes this time.

Allow a few hours, and start it when nobody needs the site

Because ShareMaster works through the library in small pieces instead of one sweep, the time grows with the item count. SharePoint also slows down any account that sends a lot of requests, and the tool waits out that throttling rather than failing. A library with hundreds of thousands of documents can take hours.

So start it before you go home, or on a Friday afternoon, and let it run. 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 on the same library. Whatever was already removed is gone, so there is less to do the second time.

Then get the storage back

Unless you chose permanent delete, 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 ShareMaster's recycle bin tools to empty several bins at once. 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. The same ShareMaster tool can empty one subfolder instead of the whole library: drill into the folder in the picker before you start.

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?

Unless you tick permanent delete, 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 run before you leave and come back to an empty library.

Try ShareMaster free for 14 days

Last updated