It is because the SharePoint server will attempt to check every 10 minutes whether the user performing the edit still has the file handle open for editing.
According to the KB - waiting 10 minutes usually resolves the problem - http://support.microsoft.com/kb/899709
Sometimes, even though the user has checked in.closed the file after making his changes, other users still could not access the file for editing.
As stated in this article - http://www.techtimepiece.com/2012/04/sharepoint-error-file-is-locked-for.html
This could be due to the following reasons:
- System crashes while the file is still open.
- File has been closed unexpectedly.
- Check in was not successful.
- Network connection is lost while file is still open.
And this is the suggested solution:
- Check whether the file has been properly checked in or not. If not, refresh the page and try to check in the file again.
- Delete the local copy of the file present in the cache folder of the concerned user account (access to user’s PC required).
- Close all the instances of file type opened in the system. E.g. if the file type is excel, then close all the excel files currently opened.
- Also kill the file type service (excel in this case) using the task manager.
But if all fails, there is trusty ol PowerShell to the rescue!
Run this script in your web application server:
$gc = Start-SPAssignment
$web = ($gc | Get-SPWeb )
$list = $web.Lists[" "]
$item = $list.GetItemById( )
$file = $item.File
$userId = $file.LockedByUser.ID
$list = $web.Lists["
$item = $list.GetItemById(
$file = $item.File
$userId = $file.LockedByUser.ID
if (![string]::IsNullOrEmpty($userId))
{
$user = $web.AllUsers.GetByID($userId)
Write-Host "File is being locked by... "
$user
Write-Host "Attemping to release lock... "
{
$user = $web.AllUsers.GetByID($userId)
Write-Host "File is being locked by... "
$user
Write-Host "Attemping to release lock... "
$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)
Write-Host "Lock successfully released... "
$impWeb = $impSite.OpenWeb()
$impList = $impWeb.Lists[$list.Title]
$impItem = $impList.GetItemById($item.ID)
$impFile = $impItem.File
$impFile.ReleaseLock($impFile.LockId)
Write-Host "Lock successfully released... "
$impSite.Dispose()
} else {
"No lock detected for $file"
}
Stop-SPAssignment $gc
} else {
"No lock detected for $file"
}
Stop-SPAssignment $gc
1 comment:
Does this script allow you to define the one document/user id that you want to unlock, or is it releasing all current file locks on the system?
Post a Comment