The file is locked for exclusive use by user... SharePoint
The file is locked for exclusive use by SharePoint
Please do not forget to comment if this helps.
Use below PS script to unlock document. (Will need farm admin access)
$web = Get-SpWeb <SP Web URL>
$item = $web.GetListItem("<Document URL including web>")
#e.g : https://my.sp.com/sites/test1/2017/myPlan.xlsx
$item.file.LockType
$item.file.LockedByUser
$item.file.LockExpires
## Unlock
$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("http:\\domain.FULLURL.com\FilaName.xlsx")
$impItem.File.ReleaseLock($impItem.File.LockId)
$web.dispose()
$impWeb.dispose()
Please do not forget to comment if this helps.
Use below PS script to unlock document. (Will need farm admin access)
$web = Get-SpWeb <SP Web URL>
$item = $web.GetListItem("<Document URL including web>")
#e.g : https://my.sp.com/sites/test1/2017/myPlan.xlsx
$item.file.LockType
$item.file.LockedByUser
$item.file.LockExpires
## Unlock
$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("http:\\domain.FULLURL.com\FilaName.xlsx")
$impItem.File.ReleaseLock($impItem.File.LockId)
$web.dispose()
$impWeb.dispose()
Worked like a charm! Thank you.
ReplyDeleteGlad that it worked ..
ReplyDeleteDziaĆa jak ta lala. It was in Polish, means - works excellent
ReplyDelete