I'm having a problem recently, when I just create a document and after that I try to update its properties it give me this error:

The file "file" is locked for exclusive use by same User

The changes doesn't be applied, I don't know if it's some configuration in the document library I made for mistake or what, if somebody know how can I solve it, it would be awesome!

Thanks in advance

up vote 7 down vote accepted

Common reason for this type of error is

  • Either Document was open in the office Client program and some body working on it. Or client program was not close properly( terminate or crashed).
  • Windows SharePoint Services puts a write lock on the document on the server. The write lock times out after 10 minutes. Users cannot modify the document during the time when the document is locked

You have to wait for 10 mins and then try again.

In this case, can you ask the user(name mentioned in the error) try to open the document and save it.

Here is the great refrence

  • Also check if the document is checked out.

Clearing short term file lock

use these management shell commands to release lock.

$url = "http://intranet.domain.com/SITENAME" 

$fileurl = "http://intranet.domain.com/SITENAME/LIBRARY/myfile.docx" 

$web = Get-SPWeb $url 

$item = $web.GetListItem($fileurl) 

$item.File.CheckOutStatus

$item.ReleaseLock

The file could be checked out, but you have to have document versioning feature turned on for this to happen.

I've just recently started getting this issue, only with documents created in Word online. For me the workaround is to upload files instead. If you upload a document there is no lock. Some other people seem to getting the same issue Microsoft site

If you're looking for a client-side solution for Sharepoint 2013 On-Promise that can be executed in JavaScript, I found some good stuff on this blog that I have updated on mine.

To unblock the short term lock for a file:

  1. Send a request to _vti_bin/_vti_aut/author.dll with special headers/body to find the lockid
  2. Send a request to _vti_bin/cellstorage.svc/CellStorageService with a formatted body that includes the lockid
  3. The file is unlocked

Tested for Sharepoint 2013 On-Promise only. I don’t know if this solution works for Sharepoint Online or other version.
Please note that I use $SP().ajax() from SharepointPlus, but it’s equivalent to the $.ajax() from jQuery.

// full path to the document
var docUrl = "https://website.com/website/Doc_Library/Test.docx";

// start by querying author.dll to find the lockid and the user who locked it
$SP().ajax({
  url: 'https://website.com/website/_vti_bin/_vti_aut/author.dll',
  headers:{
    "Content-Type": "application/x-www-form-urlencoded",
    "MIME-Version": "1.0",
    "Accept": "auth/sicily",
    "X-Vermeer-Content-Type": "application/x-www-form-urlencoded"
  },
  body: 'method=getDocsMetaInfo%3a14%2e0%2e0%2e6009&url%5flist=%5b' + encodeURIComponent(docUrl) + '%5d&listHiddenDocs=false&listLinkInfo=false',
}).then(function(source) {
  // go thru the source page returned to find the lockid and current user
  var nextLine = false;
  var ret = { "lockid":"", "user":"" };
  source.split("\n").forEach(function(line) {
    if (line.indexOf("vti_sourcecontrollockid") !== -1) nextLine="lockid"; // vti_sourcecontrollockid -> the lockid to use later
    else if (line.indexOf("vti_sourcecontrolcheckedoutby") !== -1) nextLine="user"; // vti_sourcecontrolcheckedoutby -> username of the user who locked it
    else if (nextLine !== false) {
      ret[nextLine] = line.slice(7).replace(/&#([0-9]|[1-9][0-9]|[[01][0-9][0-9]|2[0-4][0-9]|25[0-5]);/g, function (str, match) { return  String.fromCharCode(match); });
      nextLine = false;
    }
  });

  if (!ret.lockid) { alert("Not Locked") }
  else {
    // compose a request based on what Microsoft Office sends to the Sharepoint server
    // found using Fiddler
    var releaseLockReq = '<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><RequestVersion Version="2" MinorVersion="2" xmlns="'+docUrl+'" UseResourceID="true" UserAgent="{1984108C-4B93-4EEB-B320-919432D6E593}" UserAgentClient="msword" UserAgentPlatform="win" Build="16.0.8201.2102" MetaData="1031" RequestToken="1"><SubRequest Type="ExclusiveLock" SubRequestToken="1"><SubRequestData ExclusiveLockRequestType="ReleaseLock" ExclusiveLockID="'+ret.lockid+'"/></SubRequest></Request></RequestCollection></s:Body></s:Envelope>';

    // we send it to the webservice cellstorage.svc
    $SP().ajax({
      url:'https://website.com/website/_vti_bin/cellstorage.svc/CellStorageService',
      body:releaseLockReq,
      headers:{
        'Content-Type':'text/xml; charset=UTF-8',
        'SOAPAction': "http://schemas.microsoft.com/sharepoint/soap/ICellStorages/ExecuteCellStorageRequest"
      }
    })
    .then(function(res) {
      if (res.indexOf('ErrorCode="Success"') !== -1) alert("Success") // the file has been unlocked
      else alert("Failed")
    })
  }
})

I've been encountering this error rather reliably recently. After quite a bit of experimentation, I haven't found a root cause, but I think I found a workaround. Best guess is that Sharepoint Online loses sync state and file lock info for new files.

To work around it:

  1. Save your new file into the Document Library.
  2. Make some more minor changes. You don't want much, just enough to allow another save.
  3. Save the file. You should get the upload failed error.
  4. Resolve by discarding your changes. This seems to properly re-sync the file state and lock status.
  5. Make changes. Save and check in. It should succeed.

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.