Saturday, 7 July 2012

SPUnlock Tool "The file is locked for exclusive use by"

The file ""  is locked for exclusive use by domain\user
Normally you will get this when file from SharePoint library is in use in by any user in client applications that's as expected. But due to many reasons  this lock never get released even  when you are not using this file. 

SharePoint Lock and Checkout
 SharePoint lock are not same as item checkout. 

 is when user  perform through SharePoint UI for via programatically to edit a file 
 Checkout type
       Online :- The file is checked out for editing on the server.
     Offline :- The file is checked out for editing on the local computer.

Lock Type
When user open a document  in edit mode  in office client SharePoint Creates a short term  lock ( 10 min)  on the file, preventing other users from modifying it. this lock get renew by office client after every 10 min.
Lock Type 
        Exclusive: - The file is locked for editing by a single user. No other user can modify the file until the lock is released.
     Shared:- The file is locked for editing by a group who are using a collaborative application. Other users are prevented from modifying the file until the lock is released.

Note:- The checkout state of a file is independent of its locked state

Solutions for Sharepoint Accidental Lock 

  1. Wait for 10 min for lock to expire (this is true in 80 % of cases)
  2. Quick solution is to  reset  share point server ( not always feasible )
  3. Use a codeplex tool to unlock these file SPUnlock  (

SPUnlock Tool
Its a Sandbox based solution developed by me as an additional nice to have tool while working/ supporting  project issues where files get locked by user for some reason .

SPUnlock Tool Setup
  1. Download SPUnlockSandbox.wsp from
  2. Upload  SPUnlockSandbox.wsp to SP Site Collection Solution Gallery ( http:///sites//_catalogs/solutions/Forms/AllItems.aspx)
  3. Activate solution from solution gallery
  4. Confirm above step activate a  sitecollection feature "SPUnlockSandbox_Feature1" .
  5. Navigate to you site or any subsite  where and add webpart "SPFile Unlock"  to any page.
and there you go with this simple but useful tool