DEV Community

Ole Kristian Mørch-Storstein
Ole Kristian Mørch-Storstein

Posted on

Office Online 'The file is locked for shared use' error

Short breakdown

After editing files in Office Online (Office 365 and OnPrem) in a chromium based browser you might experience the following:

The file is locked for shared use by ...

Alt Text

Background

chromium based browsers all have the flag allow-sync-xhr-in-page-dismissal. This flag can be found under

  • Edge chromium: edge://flags
  • Chrome: chrome://flags

Recently it seems the default value for ths flag has been changed to "disabled". Furthermore this flag will be removed from both Chrome and Edge. If this functionality is disabled, users will frequently experience issues where recently edited office documents are locked for editing by other users and metadata cannot be changed by the current user from the web interface.

Office Online seems to rely on this functionality to unlock documents when you navigate away from the document editor interface. If not able to unlock a document, an exclusive lock will remain on the document until it expires after 30 minutes.

If you cannot reproduce the error currently, you can try to change the flag to "disabled" and you should be able to consistently reproduce the error.

How to reproduce

Note: use a chromium based browser

1) in a document library, create a new document

Alt Text

2) edit the document if you like, return to the document library when done

Alt Text

3) now try to add a title to your document

Alt Text

4) the file is locked for editing. Note that other users will not be able to edit the document at all since the current user will have an exclusive lock

Top comments (2)

Collapse
 
engineerer profile image
Kai Boschung

How did you figure out this issue arises because of this flag? I would never have guessed!

Collapse
 
okms profile image
Ole Kristian Mørch-Storstein

We saw that this particular issue was only caused by users first editing documents in Office Online, never by anyone using the client applications directly without first opening in Office Online. When testing against SharePoint onprem we also saw in the ULS logs that (shared) file locks were initialized when opening in office online, but the locks were apparently never released. This also had some side effects like the current user appearing multiple times in the "people editing this document" box. So pulling on this thread i tried to figure out how the actual lock is removed when using office online, but for the affected users no XHR traffic appeared when navigating away from Office Online.