SOLVED

Cannot Release Lock on SharePoint Online File

Silver Contributor

SharePoint thinks a user still has a lock on.  I can't adminsitratively do anything with the file online.  This has been going on for almost a day.

 

We've cleared cache, closed Excel on his computer, cleared out some local cashe directories, rebooted, etc.

 

Nothing is clearing up this lock.

 

All I want to do is delete the file at this point, and I can't even do that.

 

What are my options as a Global Admin?

96 Replies

I also had this issue. Here are the steps that worked:

  1. open file in browser-> edit and save
  2. open file in desktop app ->upload failed error 
  3. go to file->manage->checkout->edit now possible

 

Thank you @Doug Powell . Your solution helped me to unlock a PowerPoint file.

@Brent Ellis I couldn't find any way to do it through SharePoint directly.  However I did find a way to use PowerShell to release the lock.  The command is ReleaseLock

 

as in... 

$item.File.ReleaseLock($item.File.LockId)

 

I wrote about it here...

 

https://techcommunity.microsoft.com/t5/sharepoint/cannot-release-lock-on-sharepoint-online-file/m-p/...

 

 

@Charles Boisseau Just experienced the same issue with a user. To remedy I cleared the cache in Microsoft Upload Centre, no luck. Then I cleared the cache in Microsoft Upload Centre 2013, no luck. Then I cleared the internet history and cache, no luck. Then I stopped the users One Drive Sync, Success!

 

The user had accidentally clicked on the "Sync" button at the top of the library which had created a folder in One Drive which had not yet synced with SharePoint. I removed the synced folder from one drive to prevent this recoccuring.

 

Not sure if any of the actions I took prior to stopping the One Drive sync had any effect, but the above resolved the issue. 

2020 baby yeah!

I have tried every singe suggestion in this thread.

I go to Sharepoint and go to the excel file. All good Now it's time to open in excel. Nah mate! Locked by another user.

Then I ask myself... Why and now? This is Sharepoint and I can work away just find when on the document in Sharepoint. It's not locked and I can open in excel with any other user without an issue.

I can't check it out- I get an error and it only allows me to see a portion of the error

This is just stupid. Why isn't this fixed yet?

Why do we have to mess around with a bunch of workarounds that don't even work?


@MattStOnge The error you're seeing is expected. Anytime you open an Office file from SharePoint (any version, SharePoint 2010, 2013, 2016, 2019, Online, etc) using Office (2010, 2013, 2016, 2019, 365 Pro Plus, Office for Mac, etc), you are guaranteed to set a file lock. That's how the product works.

 

There are two types of locks that can be set, and Exclusive file lock, and a Co-authoring file lock. Which lock type is set is dependent on a few key factors. When opening Office files, SharePoint will always attempt to set a co-authoring lock first. If a co-authoring lock cannot be set, SharePoint falls back to an exclusive file lock.

 

Exclusive file locks act exactly as their name implies. User opens the file, because of certain factors (addressed below), an exclusive file lock is set by the user's session in SharePoint. As long as that lock is in place only the user who set the lock can edit the file. If the user saves the file when they're done and properly exits the file (doesn't put the PC in sleep mode with the file open, doesn't just close the laptop lid and walk away, doesn't leave the file open for hours on end, and instead either uses file > Close, or waits for the file to completely save, then closes out of the client), then Office can send the proper network traffic to indicate it's done with the file and SharePoint will release the lock. This is known as exiting gracefully from the file, and applies to both file lock types.

 

Co-Authoring file locks are applied when the file is in a state that allows co-authoring and if the user is in a client that supports co-authoring. Whenever a file is opened in Office Web Apps, Office Online Server, or Office for the web, where the file can be edited in the browser, a Co-authoring file lock will always be set.

 

Certain Office clients (installed on your Windows or Mac machines) do not fully support Co-Authoring. For example, Co-Authoring in Excel is only supported on Office 365 Pro Plus version 1808 and newer. All other Office desktop clients do not allow for Excel co-authoring, and will always try to set an exclusive file lock.

 

Outside of the Office clients, there are other factors specific to the file and where the files stored that determine what file lock type is set. For example, all of the following to cause only Exclusive file locks to be set:

  • The SharePoint library where the files are stored has "Checked required for editing" enabled. Even if opened in the browser, only exclusive file locks can be set for files within such a document library.
  • IRM controls on the SharePoint library or the file.
  • Setting the registry key "fsshttpoff" to a value of 1 (this is NEVER recommended)
  • Turning off the OneDrive Sync client "Use Office applications to sync Office files that I open" setting (this should be left 'On' by default).
  • Using the legacy Office file formats (*.doc, *.xls, *.ppt) instead of the current XML based file formats (*.xlsx, *.docx, *.pptx)
  • Syncing files with the old and deprecated groove.exe OneDrive for Business sync client.
  • And a few other, rarer factors.

 

@MattStOnge, for you, it sounds like other users have set a co-authoring lock on the file, but your machine can only set exclusive file locks. Since the file is Excel, check that your Office client actually supports Excel Co-authoring. If you're not on the Office 365 Pro Plus client on any of the current update channel builds  (1902, 1908, 2002, 2003, 2004) then you're never expected to be able to edit the Excel file in the excel client app in near real time with your colleagues. I would compare what version of Office you're using with that of your colleagues. If it's the same version, then your machine has another factor at play preventing you from joining the Excel file's Co-authoring session.


This functionality is more than just SharePoint or Office, there is a lot more in play. What settings are set in the SharePoint Document library, on the file itself, in the Office client, on your windows/mac machine, what group policy settings are set (if your local user account and machine are domain managed), all of these matter and can affect what type of file lock your Office client can set, and by direct relation, what can be done with said file.

@Alan Umanos 

The problem is that all the workstations are set up exactly the same with the same image.

All users except her can edit in Excel without an issue. At any given time, nobody is editing that document but it says it is locked when you try to edit with Excel just for that one user. Nobody else is having the problem.


I even went and imaged a whole new laptop for her with her profile. Went to Sharepoint to that document, said to open in excel. It worked 3 times in a row and then didn't 3 times. 

Then went back to her original laptop and when it's locked out I say "Yeah, open and then notifiy when available". About 30 seconds later, office goes "Yo, good news...your file is available to edit. Do you want to edit?"

I'm like "Yeah....Ok"

Then it goes "Sucker... The file you are looking for C:\Profilename\File location| no longer exists!"

 

This issue is making me want to cry now.
It just keeps going and going.

@Brent Ellis 

I have the same problem. In my case, it happens whenever I try to open a sharepoint file in excel, and excel always replies with a message saying the "the file is corrupt and cannot be opened" (translated). But this is not necessarily the problem.

 

What I found: The mechanism seems to work by IP. So, if I work on my notebook using Wifi and then open the document in the browser excel, and then I dock to my workplace and have another network, I can't release the lock anymore that comes from the wifi. Even worse: if I opened it from my homeoffice place, I cannot release that lock anymore from my office workplace...

So, the workaround for me (case 1) is to temporarily undock my device, then close the online excel browser tab, and then dock my device again.

@Stewart Harris This worked for me

This is excellent solution. Thank you @Doug Powell 

@Karl Øgaard 

Your description is exactly what I've been getting. The file cannot be checked out or checked in with or without versioning and require check out. Frustrating. I need to run a Power Automate flow on the file and it throws the error.

This works, sometimes... for me. How to accomplish the same with Power Automate for a file in SPO document library is the tough one for me.

@Zoltan Bagyon Have you seen this behaviour with Document Sets as well?

@Alan Umanos 

 

The Problem of this issue is that the lock persists on the web version on File creation and file editing... even in SharePoint online. 
in the past it would even say "File locked for edition" but today again we experienced this issue and now it just says "Error: the server was unable to save the form at this time". 

We tried a few other options and then we got it.... the infamous File locked for edition.... 
the file was locked for me to edit... but I'm not able to edit it's metadata... nor can I unlock the file. 

And it is a hard, impossible to fix Lock. 

Escenario: the user opens the file by accident (they wanted to edit the metadata, not the file), they quickly close the tab and boom, the file is locked in a limbo and no matter what you do, you cannot unlock the file until the session dies off. 

and just like that you're doom to wait until the sessions decides to drop the lock. 

@MPalomares Use a list and attach the documents or use a DocSet and you won't run on this issue anymore.

@Alberto_da_Silva 

 

Can you please elaborate on this? Could you provide steps how do with using a list or a DocSet?