SharePoint Document Issues

How to Fix Cannot Delete Empty SharePoint Folder Error

Huma Ashraf ChHuma Ashraf Ch Nov 4, 2026 868 views

Question details

The user is unable to delete or rename an apparently empty folder in SharePoint due to an error stating that all items must be deleted first.

How to Fix Cannot Delete Empty SharePoint Folder Error
Product
SharePoint
Device & OS
not provided
Scenario
Attempting to delete or rename an empty folder in a SharePoint document library.
Observed behavior
SharePoint displays an error saying 'You have to delete all the items in this folder before you can delete the folder.' When attempting to rename it, an error states 'Cannot lock file. Either the file is in use or the web server is temporarily busy.'
Before you start

Ensure you have the necessary site permissions to delete folders in the SharePoint library. Modifying retention policies requires a Microsoft 365 administrator account.

Solution 1Recommended

Check and Temporarily Disable Retention Policies

Identify and temporarily disable any retention policies, Preservation Hold Libraries, DLP policies, or eDiscovery holds that are locking the folder.

When a SharePoint site is governed by a retention policy or eDiscovery hold, items cannot be deleted or modified freely to ensure organizational data compliance. Even if a folder appears entirely empty, these hidden holds can prevent its deletion or renaming.

1
Log into the Purview Portal

Sign in to the Microsoft Purview portal using your Microsoft 365 administrator account credentials.

2
Review active policies

Navigate to the Data Lifecycle Management, Data Loss Prevention (DLP), or eDiscovery sections to review the active policies applied to your organization's sites.

3
Locate the specific site hold

Identify the specific retention policy or hold that is currently applied to the affected SharePoint site.

4
Modify the policy

Temporarily disable the policy or exclude the specific SharePoint site from the policy rules, ensuring this aligns with your organization's data governance guidelines.

5
Wait and retry

Wait for the policy changes to propagate across the server, and then attempt to delete or rename the empty folder again.

Check and Temporarily Disable Retention Policies
Policy Propagation Time: Changes to Microsoft 365 retention and DLP policies can take up to 24 hours to fully take effect. Please be patient and allow sufficient time before retrying the deletion.
Free Microsoft Office alternative

Looking for a Seamless Office Alternative? Try WPS Office

While SharePoint and Microsoft 365 administrative policies can be complex to manage, your daily document creation shouldn't be. WPS Office offers a free, lightweight, and highly compatible alternative to the Microsoft Office suite, allowing you to create, edit, and collaborate on Word, Excel, and PowerPoint files with zero hassle.

Highly compatible with Microsoft Office formats (.docx, .xlsx, .pptx)Lightweight installation that runs smoothly on older or low-spec devicesFree built-in PDF editing tools for seamless document managementFamiliar user interface for a zero-learning-curve transition
microsoft office alternative - wps office

Frequently Asked Questions

Why does SharePoint say 'Cannot lock file' when I try to rename an empty folder?

This error generally occurs when the folder is subject to a Preservation Hold Library or a retention policy. The server perceives the file or folder as 'in use' or locked by the system to prevent unauthorized modifications or deletions.

How can I tell if a retention policy is applied to my SharePoint site?

If you navigate to your SharePoint 'Site Contents' and see a 'Preservation Hold Library' listed among the contents, it is a strong indicator that a retention policy or legal hold is currently active on your site.

Do I need administrator rights to delete a folder locked by a retention policy?

Yes, standard users cannot bypass organizational retention policies. You must contact your Microsoft 365 administrator to review, adjust, or temporarily disable the settings within the Microsoft Purview portal.

How long does it take for retention policy changes to apply?

After an administrator disables or modifies a retention policy, it can take anywhere from a few hours up to 24 hours for the changes to fully propagate through the Microsoft 365 and SharePoint systems.