Monday, August 2, 2010

WSS - File locked for editing

Microsoft SharePoint, aka WSS 3.0, is a very common working tool today... but sometimes it happen that Windows does not completely close a Office application such as Word or Excel and a file residing on WSS is marked locked for editing when accessed by other users.

What it is important to know is that there are two types of locks in WSS: short term Locking and long term locking.

Long term check out: This is the explicit check out. This holds a lock on the document whether you have it open for edit or not.

Short term check out: You get this feature implicitly. If you open a document for editing, you get a short term lock on the document to prevent other people from editing the doc while you are.

The Office client applications refresh this lock periodically as long as you keep the document open. Once you close the document, your short term check out is released. The duration of the short term lock message is three minutes.

If the application is terminated before it releases a document, after 10 minutes WSS will release the document. This is the default behaviour under Windows.

If you need to quickly delete the lock, then the first solution is to ask the owning user to verify that he has properly closed the application (as Excel or Word), and double check that in Task Manager there are no pending Excel or Winword processes keeping the file locked. Kill them if any.

Should this solution not help you, you can directly update the file lock in SQL on the Sharepoint Database

First open SQL Server Management Studio and connect to the database server hosting the WSS database. Connect to the Sharepoint content and versioning database (WSS_Content_*)

It is now necessary to modify the contents of the Alldocs table.
The AllDocs Table stores data for all documents in the content database.

So, let's run a query against the Alldocs table:

Select * From Alldocs Where LeafName like '%filename%'

Then perform a sql update on the needed file:

Update Alldocs set CheckoutUserID = null, NextToLastTimeModified = null where LeafName = 'filename'

Now the lock has been deleted and the file should be happily accessible!

1 comment:

  1. YOu must also set checkedout and checkedout expires to null


Related Posts Plugin for WordPress, Blogger...