File is locked for editing by ‘domain\username' when editing office document in SharePoint site

Introduction

The file is locked for editing by ‘domain\username' when editing Office document in SharePoint site.

Issue

Sometimes, when we try to edit a document uploaded on SharePoint, we get a file locked error: “File is locked for editing by ‘domain\username’ “, even though the file has been checked in and no one else is editing the file.

Cause

Usually a file is locked by WSS when a particular user has ‘checked out’ the file for editing purposes. A write lock is created so that no other user can edit this file simultaneously. There can be numerous reasons for this. Below are the some of the reasons:

  1. System crashes while the file is still open.

  2. The file has been closed unexpectedly.

  3. Check in was not successful.

  4. Network connection is lost while the file is still open.

Make sure to check the below to resolve the issue.

  1. Check whether the file has been properly checked in or not. If not, refresh the page and try to check in the file again.

  2. Delete the local copy of the file present in the cache folder of the concerned user account (access to user’s PC required).

  3. 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.

  4. Also, kill the file type service (excel in this case) using the task manager.

Solution

Please follow the below-mentioned resolutions if issue still exists.

  1. Download the wsp from the site: https://spunlockfiles.codeplex.com/
  2. Upload it to the site collection solution gallery
  3. Activate the solution from solution gallery
  4. Activate the solution at the site collection level
  5. Add the web part named as “spfileunlock” to any page and Try to check the issue again.

Note: If you find a different solution, please report it as a comment to this post. This will be useful to the SharePoint Community. Be sure to double-verify it: undo your solution and verify that the problem comes back, then redo it and verify that the problem goes away.

See Also

  1. SharePoint Resources on the TechNet Wiki
  2. SharePoint 2013 Portal
  3. SharePoint 2013 - Service Applications
  4. SharePoint 2013 - Resources for Developers