Retention Label Blocks File Deletion: Root Cause and Fix
🔍 WiseChecker

Retention Label Blocks File Deletion: Root Cause and Fix

When you try to delete a file in SharePoint or OneDrive, you may see an error message saying the file cannot be deleted because it has a retention label applied. This happens even if you are a site owner or have full control permissions. The root cause is that the retention label is configured to prevent permanent deletion of content for compliance reasons. This article explains why retention labels block deletion, how to identify which label is causing the block, and the exact steps to remove the label or adjust the retention policy so you can delete the file.

Key Takeaways: Fixing Retention Label Blocking File Deletion

  • Microsoft Purview compliance portal > Data Lifecycle Management > Labels: Check the label’s retention action setting; if set to “Retain items forever,” deletion is blocked.
  • SharePoint document library > Info panel > Details: Find the exact retention label applied to the file to know which policy to modify.
  • PowerShell cmdlet Remove-ComplianceTagAssignment: Removes a retention label from a file when the UI does not allow it due to the label being locked.

ADVERTISEMENT

Why a Retention Label Prevents File Deletion

A retention label is a setting applied to a file that tells SharePoint or OneDrive how long to keep the file and what to do when that period ends. The label can be set to retain the file for a specific number of days, forever, or until a specific event. When a label is configured to retain content, the system prevents any user from permanently deleting the file. This overrides normal permissions. Even a site owner cannot delete a file that has a retention label with a “retain” action. The label is enforced by the Microsoft 365 compliance system, not by SharePoint permissions. The block occurs because the compliance policy is designed to preserve records or regulated content. The file remains in a locked state until the retention period expires or the label is removed by a compliance administrator.

How the Retention Label Works

When a retention label is applied to a file, the file’s metadata includes a compliance tag. This tag links to a retention policy in Microsoft Purview. The policy defines the retention action: retain only, retain and then delete, or delete only. If the action is “retain items” for any duration, the file cannot be permanently deleted. The file can still be moved or copied, but deletion attempts return an error. The label may be applied automatically via auto-labeling policies, manually by a user, or through default label settings on a document library.

Common Scenarios That Trigger the Block

The most common scenario is a user manually applying a label that has a retain action. Another scenario is a default label on a library that automatically applies a retention label to all new files. The block also occurs when a retention policy is published to a site via auto-labeling and a file matches the policy criteria. In all cases, the result is the same: the file cannot be deleted.

Steps to Remove the Retention Label or Allow Deletion

Follow these steps in order. You must have the Records Management role or be a Compliance Administrator to modify retention labels. If you are not an admin, contact your compliance team.

  1. Identify the retention label applied to the file
    Go to the SharePoint or OneDrive location where the file is stored. Select the file, then click the Info icon in the toolbar. In the Details pane, look for the Retention label field. Write down the label name exactly as it appears.
  2. Check the label’s retention action
    Go to the Microsoft Purview compliance portal at https://compliance.microsoft.com. Select Data Lifecycle Management, then Labels. Find the label you identified. Click on it to open its settings. Under Retention, note the action: Retain items, Retain items and then delete them, or Delete items. If it says Retain items for any duration, deletion is blocked.
  3. Option A: Remove the label from the file using PowerShell
    If you cannot change the label policy, you can remove the label from the specific file. Open SharePoint Online Management Shell as an administrator. Run the following command to connect: Connect-SPOService -Url https://yourtenant-admin.sharepoint.com. Then use the command Remove-ComplianceTagAssignment -FileUrl "https://yourtenant.sharepoint.com/sites/yoursite/library/file.docx". This removes the label from that file. After removal, you can delete the file.
  4. Option B: Modify the retention label policy
    If you want to allow deletion for all files with that label, edit the label. In the Purview portal, select the label and click Edit label. Under Retention, change the action to Delete items only or set a shorter retention period that has already expired. Click Save. Then wait up to 24 hours for the change to propagate. After that, the file can be deleted.
  5. Option C: Delete the file after the retention period expires
    If you cannot modify the label or remove it, you must wait until the retention period ends. The file will then be automatically deleted or become deletable depending on the label action. Check the label’s settings for the exact duration.

ADVERTISEMENT

If SharePoint Still Has Issues After the Main Fix

File still shows the retention label after removal

If you used PowerShell to remove the label but the file still shows a retention label in the Info panel, the label may be applied by a site-level default label. Go to the library settings, select Library settings > Default retention label. Remove the default label setting. Then refresh the file’s properties.

Error says file is a record and cannot be deleted

Some retention labels also mark the file as a regulatory record. Records cannot be deleted under any circumstances. To delete the file, you must first change the label to one that does not mark content as a record. In Purview, edit the label and under Records management, change the setting to not mark as a record. Then remove the label from the file.

Cannot remove label because it is locked by a policy

If the label is published via a retention policy that is set to locked, you cannot remove the label from individual files. The only option is to wait for the retention period to expire or to delete the entire retention policy in Purview. Deleting the policy requires Compliance Administrator rights.

Retention Label Types and Their Effects on Deletion

Item Retain Only Retain and Then Delete Delete Only
Description Keeps the file forever or for a set duration Keeps the file for a set duration, then deletes it Deletes the file after a set duration
Blocks manual deletion? Yes, permanently Yes, until the retention period expires No, file can be deleted at any time
File becomes deletable after period? No, never Yes, after the period ends Yes, immediately
Common use case Regulatory records Standard compliance retention Automatic cleanup of old files

Now you understand that a retention label blocks file deletion only when the label has a retain action. You can use PowerShell to remove the label from a specific file, modify the label policy to change the retention action, or wait for the retention period to expire. For files marked as records, deletion is not possible unless you change the label’s record setting. Always check the label’s retention action first before attempting any fix.

ADVERTISEMENT