“Library is Locked” – Troubleshooting Guide for SharePoint
If you’re seeing the “Library is locked” error in SharePoint, it means that the document library is in a read-only state, preventing modifications such as uploading, editing, or deleting files. This issue can occur for multiple reasons, including site collection being read-only, content database issues, retention policies, or an active SharePoint migration.
This guide provides a step-by-step troubleshooting process to resolve the problem and regain access to your SharePoint document library.
Step 1: Verify the Library Lock Status
Before attempting to fix the issue, confirm whether the document library is actually locked.
1. Check the Library Status in SharePoint
- Open SharePoint Online or SharePoint On-Premises.
- Navigate to the document library where you are experiencing the issue.
- Try to upload or modify a file.
- If you see the “Library is locked” message, continue troubleshooting.
2. Check for Site Collection Lock Status (Admin Required)
For SharePoint administrators, check if the entire site collection is in read-only mode:
- Go to SharePoint Admin Center (admin.microsoft.com) for SharePoint Online.
- In the left panel, select Active Sites.
- Find the affected site and click on it.
- Under Storage and Quota Settings, check if the site is marked as read-only.
✔ Solution: If the site is locked, follow the next steps to unlock it.
Step 2: Check If a SharePoint Migration Is in Progress
If your organization is migrating data between SharePoint versions or to Microsoft 365, the library may be locked automatically.
1. How to Check for an Active Migration
- Ask your IT administrator if a data migration is in progress.
- If your company is transitioning from SharePoint 2013/2016/2019 to SharePoint Online, some libraries may be temporarily locked.
✔ Solution: Wait for the migration to complete before making changes.
Step 3: Unlock the Document Library Using SharePoint Admin Center (For Online Users)
If you are an admin and your SharePoint Online site is locked, you can unlock it via the Admin Center.
1. Unlock the Library via SharePoint Admin Center
- Open Microsoft 365 Admin Center: https://admin.microsoft.com.
- Click on SharePoint Admin Center in the left menu.
- Navigate to Active Sites.
- Find your locked SharePoint site and select it.
- Click Settings > Storage Limit and Site Status.
- If the site is in Read-Only mode, change it to Unlock or Normal.
- Click Save Changes.
✔ Solution: This will restore editing capabilities in the document library.
Step 4: Unlock the Site Using PowerShell (For Admins – SharePoint Online & On-Premises)
If the site collection is locked, you can manually unlock it using PowerShell.
1. Open PowerShell as Administrator
- Press Windows + R, type powershell, and press Enter.
- Run the following command to connect to SharePoint Online:
Connect-SPOService -Url https://yourtenant-admin.sharepoint.com
- Enter your admin credentials when prompted.
2. Check the Current Lock Status
Run the following command to check if the site is locked:
Get-SPOSite -Identity https://yourtenant.sharepoint.com/sites/YourSite | Select-Object *
If the output shows ReadOnly, the site is locked.
3. Unlock the SharePoint Site Collection
Run this command to remove the read-only lock:
Set-SPOSite -Identity https://yourtenant.sharepoint.com/sites/YourSite -LockState Unlock
✔ Solution: This will restore editing permissions to the library.
Step 5: Check for Retention Policies or Compliance Locks
Some SharePoint libraries may be locked due to compliance rules set by Microsoft Purview (formerly Compliance Center).
1. Check Retention Policies in Microsoft Purview
- Open the Microsoft Purview Compliance Center: https://compliance.microsoft.com.
- Go to Data Lifecycle Management > Retention Policies.
- Look for any active retention policies on your SharePoint site.
✔ Solution: If a retention policy prevents modifications, work with your compliance team to update or remove it.
Step 6: Check If the Site Is in Read-Only Mode Due to a Full Storage Limit
If your SharePoint Online site has exceeded its storage limit, the entire site automatically switches to read-only mode.
1. Check Available Storage
- Open SharePoint Admin Center.
- Click Active Sites > Select your locked site.
- Click Storage Metrics to check the available space.
✔ Solution:
- If the storage is full, delete unnecessary files or ask IT to increase storage quota.
- Consider moving large files to OneDrive or Azure Storage.
Step 7: Restore the Library from Site Collection Administration (For On-Premises Users)
If you’re using SharePoint On-Premises (2013/2016/2019) and the library is locked, try unlocking it from Central Administration.
1. Unlock Site Collection via Central Administration
- Log in to SharePoint Central Administration.
- Under Application Management, select Manage Web Applications.
- Click on the web application containing your locked site.
- Under General Settings, check if the site is set to read-only.
- If yes, change it to “No restrictions” and click OK.
✔ Solution: The document library should now be unlocked.
Step 8: Restart IIS and Check Database Lock (For On-Premises Users)
In some cases, a SQL Server database lock may cause the SharePoint library to become read-only.
1. Restart IIS (Internet Information Services)
- Open Command Prompt as Administrator.
- Run the following command:
iisreset
- Wait for the IIS service to restart, then check if the library is unlocked.
2. Check Database Lock in SQL Server
- Open SQL Server Management Studio (SSMS).
- Connect to your SharePoint Content Database.
- Run the following query to check for a read-only lock:
SELECT name, is_read_only FROM sys.databases
- If the database is in read-only mode, unlock it using:
ALTER DATABASE [YourDatabaseName] SET READ_WRITE
✔ Solution: This will restore database write access, unlocking the SharePoint library.
Step 9: Contact IT Support or Microsoft Support
If the issue persists after trying all steps:
✅ Provide IT Support With:
- SharePoint URL where the issue occurs.
- Screenshot of the error message.
- Recent changes (e.g., site migration, retention policies, quota limits).
📞 For Microsoft 365 Users: Contact Microsoft Support via the Microsoft Admin Center.
Final Thoughts
🔹 For SharePoint Online Users: Unlock the site via Admin Center or PowerShell.
🔹 For SharePoint On-Premises: Check SQL Database Locks or Central Administration Settings.
🔹 For Compliance Issues: Review Retention Policies in Microsoft Purview.
🔹 For Storage Issues: Free up space or increase storage quota.
Would you like help with PowerShell scripts or a specific SharePoint version?