Hi this is Prem, in this blog we will talk about the error, If attempting to delete a non-empty folder, It’s possible that it’s on Hold, when we try to delete a folder which has multiple subfolders and or files within it.
The error can be seen as below, It can occur on OneDrive or even on SharePoint site as well:
Steps to Fix If attempting to delete a non-empty folder, It’s possible that it’s on Hold Error:
If you are getting the error on your OneDrive or SharePoint site when you try to delete a folder with multiple sub folders and files in it, it could be because of a hold.
How to check which Hold is getting applied to the affected site:
We will check if the OneDrive or SharePoint site is on hold or not by going to the admin center and running the Diagnostic.
Copy the URL of the affected OneDrive or the SharePoint site, example of each type of site is shown below:
OneDrive URL: https://prems-my.sharepoint.com/personal/admin_prems_onmicrosoft_com/
SharePoint URL: https://prems.sharepoint.com/sites/Test2
You only have to copy the part which is required of the sites as shown above, OneDrive URL will end with the User email address in my case it is admin_prems_onmicrosoft_com
SharePoint URL should end with the site name, in my case site name is Test2
In the admin center, click on the Help & support widget on the bottom right, which looks like this:
Once opened, search for the following term: Diag: Invalid retention policy for SharePoint or OneDrive
Or to directly go the the Diagnostic page use the following link: https://aka.ms/PillarInvalidRetention
You will see the following window:
Paste the OneDrive or SharePoint URL which has the error “If attempting to delete a non-empty folder, It’s possible that it’s on Hold” and was copied earlier:
Above, I have added my OneDrive URL: https://prems-my.sharepoint.com/personal/admin_prems_onmicrosoft_com/, do make sure to remove any spaces after pasting it.
Once the URL is pasted, Click on Run Tests:
For my OneDrive it was able to find that there is a site level hold present:
If you see in the results that, there is an Invalid hold or Invalid retention policy present on the site, you can simply remove the same by following the steps shown on the Diagnostic.
Once you remove it, you should be able to delete the folders without the error, If attempting to delete a non-empty folder, It’s possible that it’s on Hold.
Note: Please keep in mind, Once you remove any kind of hold from any site, the files which are kept on hold by the servers will be deleted. Other files on your site should not be affected .
Steps to remove Site level hold from the OneDrive or SharePoint site:
Go to Retention policy tab in the compliance admin center.
Check the Policy created and click on them to see which is getting applied to SharePoint and OneDrive:
For my case, I have multiple policies which are getting assigned to OneDrive and SharePoint, I will have to edit each one of them and exclude my Site which is having the error.
Select the policy one at a time and click on Edit:
Click on Next as we will not make changes here:
Click Next:
Then click Next, again:
On Retention settings page, we will exclude the OneDrive or the SharePoint URL depending on our need:
Click on Edit under excluded column, beside OneDrive or SharePoint as highlighted above.
For my case, I have the issue on OneDrive so I will paste the affected OneDrive URL and click on the + sign to add it, then Select it and click on Done to save it:
Steps to exclude are the same for SharePoint site as well. Once successfully excluded, you should see the count as below:
Click on Next, Next and Submit to submit the changes. Give it couple of hours or 24 hours max and check the behaviour.
You can also refer, Microsoft official article for removal of invalid hold.
Note: Please keep in mind, Once you remove any kind of hold from any site, the files which are kept on hold by the servers will be deleted. Other files in your site should not be affected.
Do let me know in case you have any question by dropping the same in the comment section.
Date: 14/08/2023
Author: Prem
Tag: Fix If attempting to delete a non-empty folder, It’s possible that it’s on Hold error.
Thanks for this. I didn’t understand why I couldn’t delete empty folder, before reading this and discovering someone had created a retention policy for SharePoint in my tenant. Good writeup!
Thanks for your comment!