Unable to delete OneDrive file due to retention policy

Selvapriyan Ramachandran 20 Reputation points
2026-08-19T00:35:38.73+00:00

User is trying to delete a OneDrive file which has 1000 version and it's filling up the OneDrive space. When user tries to delete the file its throwing "Version of this item cannot be deleted because it on hold or retention policy" We do have rention policy in place. How can I exclude the policy using PowerShell and delete the file and put back the policy?

Microsoft 365 and Office | OneDrive | For business | Windows
0 comments No comments

Answer accepted by question author
Jade Ng 15,480 Reputation points Microsoft External Staff Moderator
2026-08-19T01:30:27.8433333+00:00

Dear Selvapriyan Ramachandran,

The error message Versions of this item cannot be deleted because it is on hold or retention policy typically indicates that the document or its versions are currently protected by either a Microsoft Purview Retention Policy or an eDiscovery Hold.

To determine the exact cause, I recommend first running the Invalid Retention or grace eDiscovery Hold diagnostic in the Microsoft 365 admin center. This diagnostic can identify whether an invalid retention policy or an eDiscovery hold is preventing the deletion of the document versions.

Depending on the results:

Option 1: The file is protected by a Retention Policy

Review this article for the Set-RetentionCompliancePolicy PowerShell cmdlet: Set-RetentionCompliancePolicy (Exchange PowerShell) | Microsoft Learn

This cmdlet includes both-Add* and-Remove* parameters that can be used to add or remove SharePoint/OneDrive locations from a retention policy. If you need to temporarily exclude the affected OneDrive site, use the appropriate-Remove* parameter first. After the file versions have been deleted, you can reapply the policy by using the corresponding-Add* parameter.

Option 2: The file is protected by an eDiscovery Hold

Review this article for the Set-CaseHoldPolicy PowerShell cmdlet: Set-CaseHoldPolicy (Exchange PowerShell) | Microsoft Learn

Similar to retention policies, the cmdlet provides both-Add* and-Remove* parameters. You can remove the affected OneDrive or SharePoint location from the hold, perform the required cleanup, and then add the location back to the hold policy afterwards.

Please note that policy changes may take some time to propagate throughout Microsoft 365. Additionally, if the site was recently removed from a retention policy or hold, a grace period may still prevent deletion attempts.

Reference article: Can't delete a site because of a retention policy or eDiscovery hold

I hope this helps. Welcome to share any updates when you have time if you need further help on this issue.

Thank you very much for your valuable time and your cooperation.

Was this answer helpful?

1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.