The file Document.docx is locked for shared use by user in SharePoint

It is time for a classic SharePain today.

Locked for shared use

You open a document in Office online and edit the document. Then you try to rename is and you get the following error message:

The file “Document.docx” is locked for shared use by username@tenant.onmicrosoft.com

The file "Document.docx" is locked for shared use by username@tenant.onmicrosoft.com

I tried the same by renaming the file in the modern experience

The file is locked for shared use by user

 

When you try to open the document in word things just disappear in a black hole and Word is never opened.

Showing a document in preview

After about 30 minutes my word suddenly opens the document as the lock seems to have expired now.

There seems to be an issue with document being locked when you open a document with Office Online

I haven’t got a real solution yet. If you do then please let me know. Otherwise watch this space as I’m still investigating.

 

Possible solution

Thanks to Olivier Collet for pointing out the following solutions on TechCommunity

  1. Make sure the “webclient service” on client side is running
  2. Find registry key: HKLM\SYSTEM\CurrentControlSet\Services\WebClient\Parameters on their machines.
  3. Find value: SupportLocking(if no, please add), set its value to 0, want to just disable lock feature.

 

 

 

 

20 thoughts on “The file Document.docx is locked for shared use by user in SharePoint

  1. commented on June 19, 2018 by noellawlor

    Hi Pieter, would something like this work for you (I haven’t tested)? http://kennekro.net/2017/12/file-is-locked-for-shared-use-by-user/ . I guess you could write a flow to trigger the script when you get such a message.

    • commented on June 19, 2018 by Pieter Veenstra

      Hi Noel,
      That solution would only work in on-premises environments. I don’t think that the unlock is available within CSOM. Also I’m not sure if this is something that I could get end users to do every time they edit a document in Office Online.

  2. commented on June 19, 2018 by Andrew Jolly

    Saw this today on two different tenants.
    Once as a flow had finished doing its thing the other when I created a brand ne document online using the new button.

    Definitely a bug has surfaced here

  3. commented on June 20, 2018 by jeffangama

    It somestimes happened to me, re opening the doc in teams or word, then close docs & teams again, that fixed the issue

  4. commented on June 21, 2018 by sfennah

    When this happens I enforce checkout on the library so I can check out, edit and check in. Removing enforce check out on the library then leaves it all working as normal. This solution is ok in a training environment as its great for demonstrating the differences between libraries with and without enforced checkout but don’t think its a real world work around.

    • commented on June 21, 2018 by Pieter Veenstra

      In your case does the document remain checked out? In my case the document is not checked out. It is just locked after it was edited in office online.

      • commented on June 21, 2018 by sfennah

        Pieter, the document is not and never has been checked out, just locked as you described. When this happens I then enforce Check Out on the library and the document is not shown as checked out. I can check it out and edit. The action of enforcing check out on the library seems to force SharePoint Online to realise the document is not actually locked in any way.

        I normally see this on training courses when creating a new document in SharePoint Online and after closing the document try to edit the properties. So the document is brand new. It seems to take between 30 mins and 24hrs to release the lock for me, unless I change the library settings as described. However I’ve only found this check out solution on a course last week and it worked again this week – twice isn’t really proof of a solid solution.

  5. commented on June 25, 2018 by Rob Buckley

    Same here – started on Friday. Logged a support request with MS but even though I’ve given then step by step screenshots of how the error is caused, they insist on remotely accessing my computer before they’ll try to fix it. Which given I’m on a Mac is causing them problems…

    The different in my case is that I’m able to edit and view files, despite the lock, just not rename them, delete them, etc

    • commented on June 25, 2018 by Pieter Veenstra

      I have the feeling that it is getting worse. Any document created in office online cannot be edited within the next 30 minutes ot so

  6. commented on June 26, 2018 by rfjschouten

    Hi Peter, I had similar problems like you describe. When we click new document on a library and it opens it in Office Online, you rename the document and afterwards would like to set some required meta data in the library itself, we get same error message that document is locked by yourself. We managed to ‘fix’ this by setting the following attributes on the library trough PnP provisioning: EnableVersioning=”true” EnableMinorVersions=”true” MinorVersionLimit=”100″ MaxVersionLimit=”500″ DraftVersionVisibility=”0″. Setting these options doesn’t lock the file anymore.

    Maybe this will give you some new insights or help you out.

    • commented on June 26, 2018 by Pieter Veenstra

      Hi Robert, I think that that is similar to Sara’s comments. I have the feeling that something has changed to the out of the box library or Office Online is not able to deal with out of the box settings. Either way this should be fixed.

      I’ve reported this to Microsoft on twitter, but I’m still waiting for them to resolve the issue. I’m hesitant changing out of the box library settings as a workaround.
      https://twitter.com/PieterVeenstra/status/1009037750543233024

      I wonder if this is related to the changes currently made to document libraries and Office Online is assuming new settings.

  7. commented on June 28, 2018 by Sigge

    Hi,
    we have about 100 users who work’s online in SharePoint libraries. Many of us has this locked problems, even me admin. We have a case and Microsoft India is working on this huge problem.
    When a user open a document, edit it=locked by himself
    He can’t rename, delete, move or copy it for about 1-24 h
    When you open it in desktop Word, you can see that is locked by myself, sometimes 2, 3 or more instances of the same user or other users.
    It is a huge issue for us in our organisation and we need help NOW. Users are frustrating, and Microsoft tells us every second day to wait, “we are working on a solution”…..

  8. commented on July 10, 2018 by Sigge

    MS SharePoint Online Team have finally updated the new version of SQL Tables and modified release times in the code(error 500 via https request).
    Info:
    HTTP/1.1 423 Locked
    Cache-Control: private, max-age=0
    Transfer-Encoding: chunked
    Strict-Transport-Security: max-age=31536000
    X-FRAME-OPTIONS: SAMEORIGIN
    X-Powered-By: ASP.NET
    MicrosoftSharePointTeamServices: 16.0.0.7806
    X-Content-Type-Options: nosniff
    X-MS-InvokeApp: 1; RequireReadOnly

    We have tested our SharePoint libraries via different users and verified Connection to SharePoint Online via software Fiddler Web Debugger.

    Everything seems OK, all users can copy, rename, move, edit same file over again also…

  9. commented on August 22, 2018 by Francis

    Peter:

    Did you ever resolve this? This happened to me with a document last month. A month passed, and I still cannot rename the document because it is “locked by another user” but the other user’s email address is my own.

    • Hi Francis,
      I found that when the locks last longer than a day that there were often background processes ( like Flow, SharePoint Workflows, PowerShell or anything else locking the files). i would be interested to see the version history on this document that is locked. Are you able to email that to me?

  10. Have seen this a lot lately I’m multiple tenants.
    Did you ever had a soloution to this?

    • Hi Per,
      I am suspecting background processes or forgotten locks but I havent been able to find an cause for it. Badly designed Flows or PowerShell script can cause these problems.
      Do you have any background processes running?

  11. commented on October 1, 2018 by Olivier Collet

    Hi, a similar post speaks of the same problem https://techcommunity.microsoft.com/t5/SharePoint/Cannot-Release-Lock-on-SharePoint-Online-File/td-p/59694

    you have to change a registry key and it worked for me

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: