A Microsoft file hosting and synchronization service.
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.