2

I've a DocumentLibrary 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 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 I can't do anything by UI and I should wait untill 10 minutes before to proceed saving properties, someone says it can take more than 10 minutes but, anyway, I can't wait neither 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 (only for SharePoint Server): any advice?

Thanks in advance.

0

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

For more information, refer this link

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

| improve this answer | |
  • if you find my answer useful, kindly upvote and accept it as answer, so that it will help others too. – Karthik Jaganathan Jan 14 at 17:48
0

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

$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

$impFile.ReleaseLock($impFile.LockId)

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

| improve this answer | |
0

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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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