Two different errors, same fix!
File is locked for editing by domain\username
is locked for shared use by domain\username
Before you do this, make sure you have a copy of the file that is locked. Open the Library in Explorer View and create a copy of the file, or save a copy to your desktop.
Bottom line, you will need to either write a PowerShell script to update the CheckoutExpires field in the Content Database or go directly into the Content Database and update the record. I know, you should never play with the SharePoint databases, great!
First we will need to get the correct Content Database and ID for the locked file.
if(-not(Get-PSSnapin | where { $_.Name -eq "Microsoft.SharePoint.PowerShell"})) { Add-PSSnapin Microsoft.SharePoint.PowerShell; } $site = Get-SPweb "http://sharepointed.com/taco" $spList = $site.lists["Soft Taco"] $i = $spList.GetItemById("14") $SQLconn = $i.Web.Site.ContentDatabase.DatabaseConnectionString $id = $i.UniqueId
What I’m doing is getting the database connection string and the ID of the file.
Now, crack open SQL Server Management Studio. Navigate to the Content Database that we identified in the $SQLconn string above. Create a new Stored Procedure and paste in the following script.
Now you will need the value from $id.
Select * from dbo.AllDocs WHERE Id = '89c87af8-758b-4186-ffaa-c78a13695aec'
Once you run the above query, you should see the record that is locked. Make note of the CheckoutExpires field, the is what we are going to update.
Next you will want to run the update script that will unlock the file.
UPDATE dbo.AllDocs SET CheckoutExpires = '2000-01-22 13:24:47.000' WHERE Id = '89c87af8-758b-4186-ffaa-c78a13695aec'
Refresh your browser, and the file should now be unlocked.