WebDAV Merging in Microsoft Office

Microsoft Office can merge changes with updates made by other user(s). Here is how merging works:

  1. User1 opens a document for editing. The document is locked for editing by User1.
  2. User2 opens same document for editing. As soon as the document is locked by User1, the server throws LockedException in ILockAsync.LockAsync() method implementation:

    public async Task<LockResult> LockAsync(...)
    {
        if (/* item is locked */)
        {
            throw new LockedException();
        }
        ...
    }

    The server replies with 423, "Locked", code. User2 is presented with the following dialog:

    WebDAV MS Office Merge dialog. User selects: Edit the file and merge your changes with the server file when it becomes available.

    User2 selects "Edit the file and merge your changes with the server file when it becomes available." option and edits the document.

  3. User1 saves and closes the document. The document ETag is updated and the document is unlocked.
  4. User2 saves the document. The document is locked by User2. The WebDAV server automatically compares ETag associated with a document with ETag sent by User2. If they do not match, the documents are automatically merged by MS Office or a merging UI is presented by MS Office.