1

I am having problems with the Client Side lock events of SharePoint 2013. When an user edits the document and closes it. The Client Side lock of SharePoint is working on that document.

Is it possible to make a Client Side function that releases the lock so that the user can continue to work on the document?

Thanks

  • Do you find client side script to process release lock? We cannot run script at server-side without proper application procedure. – Mark L Dec 30 '15 at 8:09
3

If you mean the short-time locks placed on Office documents by SharePoint, I described a method how to remove such locks using FrontPage Server Extensions (FSE) requests sent via JavaScript in this post. In first step you should invoke the getDocsMetaInfo method to get some info regarding the lock (like its ID, release date, etc.), then construct and post an XML to the CellStorage web service to request the release of the lock.

However, I prefer to release such orphaned locks via PowerShell as described here.

For example (if the file is locked by the current user):

$ft = New-Object System.TimeSpan(10000) 
$file.Lock([Microsoft.SharePoint.SPFile+SPLockType]::Exclusive, "test lock", $ft) 
$file.UndoCheckOut()

or (if the file is locked by another user):

$web = Get-SPWeb http://intranet.contoso.com 
$list = $web.Lists["DocLib"] 
$item = $list.GetItemById(2) 
$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 
$impFile.ReleaseLock($impFile.LockId)
  • Thanks, I saw that powershell already in my search result, but didn't find the Javascript solution. I agree with you that it is a kind of a problem the locks, but I need to figure something out to solve my users problem. – pipelinecache Nov 23 '14 at 17:07

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.