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
Thanks for the fix, I will try this next time! Be nice for a permanent fix by Microsoft though........
To add to Trevor's post, any time a file is opened from SharePoint, regardless of using Office Online or the Office client, a lock state will be set. If we're only looking at opening files using the Office client, and file check out is not required in the SharePoint doc library, then the lock state is determined by the end user's Office client. If the user has Office 365 Pro Plus Click to Run, and is on the Monthly update channel, then the user will always set a co-authoring lock unless checking out a file. If on say, the Office 365 Pro Plus MSI client, then any time a user opens an Excel file from SharePoint, the lock state will ALWAYS be an exclusive lock since Office 2016 / Office 365 Pro Plus MSI cannot co-author with Excel files in the client. Because a lock state will always be applied when opening files, if a file has an exclusive lock set and SharePoint is never told the end user is done editing said file, the file lock will remain until the lock either expires or SharePoint is told the user who set the lock is done with the file. Regardless of lock type (Co-authoring or Exclusive), If a lock is applied to a file, it cannot be renamed, moved, or deleted. However It can still be copied or downloaded locally. If the Office client crashes while saving the file, or the internet connection drops, the pending file information will show up in the MS upload center where it can be pushed back to SharePoint, thus releasing the lock.

try this,

 

Open the file in office client in read only mode. As soon as it opened in the office client, then check it out.

I particularly love this error combination.

2018-10-30 11_53_57-Table Test.xlsx.png

Excel says I'm the only one here, but I can't make changes since I'm not alone...

This is funny but also frustrating!
We're getting the locked out issue again today, by restoring a previous version and then restoring the correct version, this resolves the problem.

Microsoft needs to fix this permanently though.

Doesn't work for me. 

 

I'm on a Mac. Using Chrome. A file I opened and edited is still locked by me. No one else has worked on it. I closed the browser. I shut Word. There is no unlock option. Does someone have step-by-step instructions to close a file that a ghost of myself has locked? 

The Word file in OneDrive/sharepoint doesn't open in a new browser. It is locked by the ghost of me. I can't unlock it. I'm stymied.

Can't thank you enough for this reply. Great job!

This problem is a result of Office Client setting a 'lock'.. that isn't a SharePoint check-out lock, and a network glitch misses clearing the lock. SharePoint usually notices within 15 or 20 minutes.. but not always.
I found a way to release this lock on-premises using PowerShell. I would think there is a PnP version that does the same on SPO.

I neglected to document where I plagiarized this from, so I cannot credit the original author
====================

#this script overrides a file lock that occasionally occurs when a file is opened in the client, but is closed unexpectantly.
# locks are supposed to expire after 10 minutes, but that doesn't always happen
# in this case, the file looks like it is checked in, but is locked for editing

$url = "https://WEBSITE/URL/HERE"

$fileurl = "https://WEBSITE/URL/HERE/LockedFileName.xlsx"

$web = Get-SPWeb $url
if($web -ne $null)
{
    $item = $web.GetListItem($fileurl)

    if($item -ne $null)
    {
        Write-Host "Found file " $item.Title
        $item.File.CheckOutStatus

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

        $userId = $item.File.LockedByUser.ID
        $user = $web.AllUsers.GetById($userId)

        $impSite = New-Object Microsoft.SharePoint.SPSite($web.Url, $user.UserToken);
        $impWeb = $impSite.OpenWeb();
        $impItem = $impWeb.GetListItem($fileurl)

        $impItem.File.ReleaseLock($impItem.File.LockId)

        $impWeb.Dispose()
        $impSite.Dispose()
        $item.File.CheckOutStatus
    }
    $web.Dispose()

}

=============

Unfortunately there is no CSOM/JSOM equivalent so it isn't possible to manually release a lock in SPO.

it seems my PC is smarter than yours and won't be bluffed - that didn't work for me :(

For one library and group of users, we have configured it to open files in their native app. Therefore, the Word Online is bypassed directly for the Word App. These users don't appear to have the File Lock issue anymore.

 

Has anyone else noticed this? Does anyone else have a Library whereby the default is set to "Open in Client Application" and doesn't have the issue with docs in that Library?

 

My guess is that previously the Word doc opened in online mode, then they clicked "Edit in Word" and so it's opened in two places. They'd edit in Word, but something may have occurred (a cursor move, etc) whereby the Online version of the same doc was 'edited' too - and that this *duopoly* is what causes the issue.

 

It's my assumption that this is what causes the File Lock issue and what needs to be focused on.

 

SharePoint Online, had this issue with a word file with "abc" written in it. Because I had locked it I could not edit the file in word online, edit the properties in Sharepoint online or delete it. And I had no idea where to deactivate the "Lock".

I found the solution for my case in this thread somewhere- Open it in word local on PC and there i could edit the files.

 

Cause of the issue:  I was testing some list features with a lot of basically empty word files in it. And I might have had word online open in that word document when I added another column to the list that was mandatory to be filled out..

But I'm not 100% sure on this because I'm old and some times I set of to do something just to end up looking into the fridge realizing I'm not hungry I struggle to remember what I was supposed to do..   


@Zoltan Bagyon wrote:

This is a very frustrating known issue in SP Online, and I can't really understand why we don't get an admin-tool (via PS, for example) to manage it.

My greatest concern is, what I've experienced many times, that the 10 minute timeframe MS promise for auto-unlock is simply not true and it took much-much longer to get access back to the file. Also the workaround they suggest here haven't ever worked for me. So my user (and admin) experience is that whenever this issue occurs, I have no other tools to fix it than waiting, and I have to tell the same to my users.


Same Problem here with Sharepoint online after making changes to excel in a flow. The Excel file is locked for hours. I read a lot of things, but all solutions I found are not for SP Online (office 365) but for SP on premise. For SP on premise are very easy solutions with powershell, but in SP Online we don't have something like "Get-Spweb".

 

- Somebody knows a solution to unlock files fast in SP Online?

- Ore any idea how to prevent Excel file locks after flow create/manipulate/copy excel files (also when the flow is crashing)?

- Any flow nodes to force an unlock available?

Hi Sebastian,

We too experience this issue, as do most people I suspect.

I haven't had the issue for a while, but one suggested solution that I have read is:

Restore the locked out file to a previous version. That essentially kicks the user (who the file thinks is editing) out and allows you to then rename/ delete/ move etc the file again.

For my solution was to close all Chrome windows

"...and Close it" That was the ticket for me. Gracefully close the document using File->Close in the client app. Previously, I was just X'ing out of the client and still could not delete the file from SP. Thanks!

 

This solved the problem for me, thanks!

After opening the Word document in Word, clicking File, clicking Manage Document, "Check Out" is grayed out. So, I'm unable to checkout/checkIn. I created the document, I am one of the owners of the MS Teams group, and from within properties it says the file is locked by me.