When you try to open a Microsoft Office file from a SharePoint document library or a shared network folder, you may see the error: “The file is locked for shared use by you or another user.” This error prevents you from editing or even opening the file in read-only mode. The root cause is a corrupted or orphaned lock file that Office creates when a file is opened for editing. This article explains why this lock file persists and provides step-by-step methods to remove it and regain access to your document.
Key Takeaways: Resolving the Locked File Error in SharePoint
- Check for hidden lock files (.tmp or ~$ prefix): Delete the hidden owner file from the SharePoint document library or network folder to release the lock.
- Force close Office applications and clear the Office cache: Use Task Manager to end all Office processes, then delete the Office Document Cache to remove stale locks.
- Use the SharePoint admin center to force a file check-out: A site collection administrator can discard a user’s check-out to unlock the file server-side.
Why the “File Is Locked for Shared Use” Error Occurs
Microsoft Office applications create a temporary lock file when you open a document for editing. This lock file prevents other users from overwriting your changes. The lock file is normally deleted when you close the document. If the application crashes, the network connection drops, or you close the file without saving, the lock file can remain on the server or in the local Office cache.
The lock file appears in the same folder as the original document. It is a hidden file with a name that starts with a tilde (~) followed by a dollar sign ($) and the original file name, such as ~$Report.docx. On SharePoint, the lock may also be stored as a metadata property on the file itself, which is why simply deleting the hidden file may not always work.
Another common cause is a corrupted Office Document Cache. The Office Upload Center stores temporary copies of files you are editing. If the cache becomes corrupt, Office may still think the file is in use even after you close it.
Step-by-Step Methods to Fix the Locked File Error
Method 1: Delete the Hidden Lock File from SharePoint or Network Folder
- Show hidden files in SharePoint
In the SharePoint document library, click the library settings gear icon and select “Library settings.” Under “Permissions and Management,” click “Allow management of content types.” Set it to Yes. Then go back to the library, click the ellipsis (…) next to any file column header, and choose “Column settings” > “Show/hide columns.” Enable the “Type” column if hidden. Files with the icon of a person or a padlock are locked. Look for any file with a name starting with~$— that is the lock file. - Delete the lock file
Select the lock file and click “Delete” in the command bar. Confirm the deletion. The lock file is removed, and the original file should now be accessible. - For network folders
Open File Explorer, go to the folder containing the locked file. Click the “View” tab and check “Hidden items.” Look for a file named~$filename. Delete it. If you cannot see the file, the lock may be held by a different mechanism.
Method 2: Clear the Office Document Cache
- Open Office Upload Center
Press the Windows key, type “Office Upload Center,” and open the app. If you do not see it, search for “Microsoft Upload Center” in the Start menu. - View cached files
In the Upload Center window, click “Settings” (gear icon). Under “Cached files,” click “Delete cached files.” A confirmation dialog appears. Click “Delete cached files” again. - Restart Office applications
Close all Office apps (Word, Excel, PowerPoint). Open the locked file again from SharePoint or the network folder. The error should be gone.
Method 3: Force Discard a Check-Out in SharePoint
- Log in to SharePoint as a site owner or administrator
Go to the site where the file is stored. Click the gear icon and select “Site permissions.” Verify you have Full Control or at least the “Manage Lists” permission. - Navigate to the document library
Open the library containing the locked file. Click the ellipsis (…) next to the file name. If the file is checked out to another user, you will see a “Discard check out” option in the menu. Click it. - Confirm the discard
Click “Discard check out” in the confirmation dialog. The file is now unlocked. Any unsaved changes made by the previous user are lost.
Method 4: Use Windows Task Manager to Kill Stuck Office Processes
- Open Task Manager
Press Ctrl + Shift + Escape. Click “More details” if you see only a small window. - End all Office processes
Look for processes named WINWORD.EXE, EXCEL.EXE, POWERPNT.EXE, or any process starting with “Microsoft Office.” Select each one and click “End task.” Do the same for any “Microsoft SharePoint” or “OneDrive” processes that might be syncing the file. - Restart Office and open the file
Open the file again from SharePoint. If the error persists, restart your computer and try again.
If the Error Still Occurs After the Main Fixes
“The file is locked for shared use” when opening from OneDrive sync
If you sync the SharePoint library to your computer with OneDrive, the lock may be held by the sync engine. Pause OneDrive syncing: right-click the OneDrive cloud icon in the system tray, select “Pause syncing” and choose 2 hours. Then try opening the file from the synced folder. If that works, resume syncing later.
“The file is locked” error in Excel Online
When editing a file in Excel Online, the lock is held by the browser tab. Close all browser tabs that have the file open. If you use multiple browsers, close them all. Then reopen the file in a single tab.
“The file is locked” even though no one else is using it
This often happens when the file was opened on a different computer and the Office application crashed. The lock file remains on the server. Ask a SharePoint administrator to check the file’s check-out status using PowerShell. The administrator can run Get-SPOFile -Site to see the lock owner and then use Set-SPOFileCheckedOut -Site to reassign the lock.
| Item | Delete Hidden Lock File | Clear Office Cache | Discard Check-Out | Kill Office Processes |
|---|---|---|---|---|
| Best for | SharePoint or network folder with visible ~$ file | Files that were edited locally and cached | SharePoint files checked out to another user | Stuck Office processes on the local PC |
| Requires admin rights | No | No | Yes (site owner or admin) | No |
| Risk of data loss | No (lock file only) | No (cache only) | Yes (unsaved changes lost) | No |
| Effectiveness | High if lock file exists | High for cache-related locks | High for SharePoint check-outs | High for local process locks |
You can now clear the locked file error by deleting the hidden lock file, clearing the Office cache, or discarding a SharePoint check-out. Start with the simplest method: check for a ~$ file in the document library. If the error persists, clear the Office Upload Center cache. For files checked out to another user, ask a site owner to discard the check-out. As an advanced tip, configure SharePoint document libraries to require check-out for editing by going to Library settings > Versioning settings and setting “Require check out” to Yes. This prevents lock file conflicts by forcing explicit check-outs.