I have a Document Library in which documents are required to be checked out, but when I create a new document, as Admin, I can't to check it in because certain required fields are empty and, at the same time, I can't edit them because there is a lock created by myself.

I've read that I can't do anything by UI and I should wait 10 minutes before proceeding to saving properties. But I don't want to wait 10 minutes. I would like to write a PowerShell script to launch every time I need to unlock my documents, but I can't find something that could work with SharePoint Online... I can only find scripts for SharePoint Server.

How can I write a PowerShell script for unlocking files in SharePoint Online?

3 Answers 3


Per my knowledge, there is noway to unlock a file in SharePoint online library neither through UI nor via PowerShell. You will need to wait for it.


There is no way do this in SPO using PowerShell. Similar question was discussed here

Summarize answer from the above thread:

"The technical reason behind this is not possible in SPO using PoerShell is the SOM property locktype is not there and neither is the method ReleaseLock.

So as this is not possible to release locks in SPO. If it is happening to you regularly raise a support call from your tenant admin center."

However, this is possible using SOM PowerShell:

$web = Get-SPWeb http://<site>/Ringo

$list = $web.Lists[“Shared Documents”]

$item = $list.GetItemById(171)

$file = $item.File


$userId = $file.LockedByUser.ID

$user = $web.AllUsers.GetByID($userId)

$impSite= New-Object Microsoft.SharePoint.SPSite($web.Url, $user.UserToken);

$impWeb = $impSite.OpenWeb();

$impList = $impWeb.Lists[$list.Title]

$impItem = $impList.GetItemById($item.ID)

$impFile = $impItem.File


Some other way of troubleshooting from your client machine:

  1. Make sure the "webclient service" on client side is running
  2. Find registry key:

HKLM\SYSTEM\CurrentControlSet\Services\WebClient\Parameters on their machines.

  1. Find value: SupportLocking(if no, please add), set its value to 0,want to just disable lock feature.

This disables the locking feature via the registry and does not impact any other services.

I would suggest that you test it one 1 machine first to see if it resolves the issue prior to pushing it out to all production machines.

More on this troubleshooting:

Cannot Release Lock on SharePoint Online File


Unfortunately you cant do this on sharepoint online. But the same is achiveable in SharePoint on prem version.

For more information, refer this link



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.