Skip to content
All articlesSharePoint

Can't Delete SharePoint Site: A Compliance Policy Is Blocking It

Fix 'Can't delete site. A compliance policy is currently blocking this site deletion': the invalid retention policy and eDiscovery hold causes and the fix.

27 Nov 20268 min read
Can't Delete SharePoint Site: A Compliance Policy Is Blocking It

What the error means

"Can't delete site. A compliance policy is currently blocking this site deletion." means a retention policy or an eDiscovery hold still applies to the site. Usually you have already removed the site from the policy, and either the policy is invalid, so the change never took effect, or an eDiscovery hold is inside its 30-day grace period. Microsoft's fix starts with a diagnostic in the Microsoft 365 admin center that tells you which one it is.

The same cause produces a second message, when you try to delete versions of a file: "Versions of this item cannot be deleted because it is on hold or retention policy."

Microsoft describes four situations that lead here:

ScenarioWhat you didWhat you see
1Tried to delete a site"Can't delete site. A compliance policy is currently blocking this site deletion."
2Tried to delete a document version"Versions of this item cannot be deleted because it is on hold or retention policy."
3Excluded or removed the site from a retention policy, then, more than 24 hours later, tried to delete the site or a versionThe message from scenario 1 or 2
4Excluded or removed the site from an eDiscovery hold, then tried to delete the siteThe message from scenario 1

Why it happens

Retention is designed to win. Microsoft's first principle of retention: "Content won't be permanently deleted when it also has retention settings to retain it." While a retention policy covers a site, the site cannot be deleted. Microsoft's retention documentation: "Users see an error message if they try to delete a library, list, or site that's subject to retention."

So the question is why the site is still covered after you removed it. Microsoft gives two causes:

  • The retention policy is invalid. "You exclude or remove the site from a retention policy. However, the retention policy is invalid." The policy still holds the site even though you edited it.
  • An eDiscovery hold is in its grace period. "The eDiscovery hold is within a 30-day grace period that prevents the site from being deleted."

There is a third, expected case that is not a fault: Microsoft states that when you release a retention policy for SharePoint sites, "any content that's subject to retention from the policy continues to be retained for 30 days to prevent inadvertent data loss." Removing a site from a valid policy is therefore not instant either.

Fix: run the diagnostic

Microsoft's resolution is a diagnostic in the Microsoft 365 admin center that checks both causes for one site.

Who can run it: "You must have at least the Compliance Administrator role to use these steps." It is not available in GCC High, DoD, or Microsoft 365 operated by 21Vianet.

  1. Open the diagnostic Run Tests: Invalid Retention or grace eDiscovery Hold in the Microsoft 365 admin center. The link is in Microsoft's troubleshooting article, "An invalid policy blocks a SharePoint site deletion".
  2. In the Run diagnostics section, enter the URL of the SharePoint or OneDrive site you want to delete.
  3. Select Run Tests.

What it can do with the result:

The diagnostic findsWhat you can do
An invalid retention policy that might be blocking the deletionChoose to remove the policy
An eDiscovery hold within the 30-day grace periodChoose to remove the hold

Then try the deletion again in Active sites: select the site, select Delete, and confirm. How to delete a SharePoint site has the full steps and what happens next.

If an eDiscovery hold is the cause

For scenario 4, Microsoft's instruction is to make sure the site's location is released from the case hold policy before you try to delete the site.

SituationCommand Microsoft names
The hold is still on the siteSet-CaseHoldPolicy, to release the location
The hold policy cannot be found with Get-CaseHoldPolicy or in the Microsoft Purview portalInvoke-HoldRemovalAction, to clean up the orphan hold

A hold usually belongs to a legal or compliance case. Check with whoever owns the case before you release anything.

Before you remove a policy

Removing a retention policy so you can delete one site is a bigger change than it looks:

  • A policy usually covers more than one site. Removing it removes retention from everything it covers. The diagnostic's option to remove an invalid policy is for a policy that is broken, not for one you simply want out of the way.
  • Preservation Lock cannot be undone. Microsoft states that Preservation Lock locks a retention policy so that no one, including an administrator, can turn the policy off, delete it or make it less restrictive. A site under a locked policy stays until the retention period ends.
  • Retention changes are slow. Microsoft says to "allow up to seven days for the retention settings to be applied to content." After removing a site from a policy, wait at least the 24 hours in scenario 3 before you conclude the policy is invalid.

If the goal is to get a finished site's content out of SharePoint storage while it still has to be kept, deleting the site is not the only route. SharePoint archiving and retention policies explains how archiving works alongside a retention policy.

The version history message

"Versions of this item cannot be deleted because it is on hold or retention policy" has the same two causes and the same diagnostic. It appears when someone tries to trim version history on a library that a retention policy or hold still covers. While the policy applies, the versions are being kept for compliance on purpose; SharePoint version history storage explains how versions count against storage and what can be reduced.

Frequently asked questions

What does "A compliance policy is currently blocking this site deletion" mean?

A retention policy or an eDiscovery hold still applies to the site. If you have already removed the site from the policy, Microsoft documents two causes: the retention policy is invalid, or an eDiscovery hold is within its 30-day grace period.

How do I delete a SharePoint site that has a retention policy?

Remove the site from the retention policy, or exclude it, and wait for the change to apply. If deletion is still blocked more than 24 hours later, run Microsoft's diagnostic "Run Tests: Invalid Retention or grace eDiscovery Hold" in the Microsoft 365 admin center, which can remove an invalid policy.

Who can run the diagnostic?

Microsoft states that you need at least the Compliance Administrator role. The diagnostic is not available in GCC High, DoD or Microsoft 365 operated by 21Vianet.

How long does an eDiscovery hold block deletion after it is removed?

Microsoft describes a 30-day grace period during which the eDiscovery hold still prevents the site from being deleted. The diagnostic can remove the hold during that period.

What is an orphan hold?

A hold that still applies to a location although its policy can no longer be found with Get-CaseHoldPolicy or in the Microsoft Purview portal. Microsoft's command to clean it up is Invoke-HoldRemovalAction.

Why can't I delete versions of a file in SharePoint?

The message "Versions of this item cannot be deleted because it is on hold or retention policy" means a retention policy or hold still covers the item. The causes and the diagnostic are the same as for a blocked site deletion.

Can I delete a site under a policy with Preservation Lock?

No one, including an administrator, can turn off, delete or weaken a policy with Preservation Lock, so the site stays covered until the retention period ends.

About the author
Mark Smith - Co-Founder, SmiKar Software

Mark Smith co-founded SmiKar Software in 2015 and has spent the past decade helping organisations solve Microsoft 365 data management challenges. He works with the SmiKar team to build solutions for SharePoint archiving, storage optimisation, governance and compliance, supporting customers from growing businesses through to Fortune 500 enterprises.

More about SmiKar

Ready when you are

Cut your Microsoft 365 storage bill - keep your data in your tenant.