mrswadge
mrswadge

Reputation: 1749

Microsoft Word ignores locked status sent from WebDAV server

I am using a custom WebDAV implementation (java servlet based). This appears to be largely working well - except Microsoft Word does not report that locked document is locked to a user. As a result the user is able to edit the document until the point they try to save it, at which point the user is greeted with an unfriendly "Upload Failed" message within Microsoft Word.

Upload Failed upon saving a document that is locked by another user.

The main aims of my question are to find if I can modify the WebDAV responses in order to do one or more of the following:

  1. Get Microsoft Word to show the user a message to say the document is currently locked.
  2. To force Microsoft Word to open the document in a read-only state if there is a lock present.

I ran up the fiddler and analysed the request and response trail, comparing notes with the specifications for WebDAV. I'm a little unsure where to look next, so help from any WebDAV experts is very welcome!


Request 1

HEAD http://webdavserver:7161/App/WebDAV/577476_Client%2C_3rd_party_or_internal_account._Rheiner_R%C3%BCckversicherungs_GmBH1.doc HTTP/1.1
User-Agent: Microsoft Office Existence Discovery
Connection: Keep-Alive
Host: webdavserver:7161

Response 1

HTTP/1.1 200 OK
Date: Wed, 05 Nov 2014 11:45:32 GMT
Content-Type: application/msword
Last-Modified: Wed, 05 Nov 2014 11:45:30 GMT
ETag: W/"77312-1415187930429"
X-Powered-By: Servlet/2.5 JSP/2.1

Request 2

LOCK http://webdavserver:7161/App/WebDAV/577476_Client%2C_3rd_party_or_internal_account._Rheiner_R%C3%BCckversicherungs_GmBH1.doc HTTP/1.1
Cache-Control: no-cache
Connection: Keep-Alive
Pragma: no-cache
Content-Type: text/xml; charset="utf-8"
User-Agent: Microsoft Office Core Storage Infrastructure/1.0
Translate: f
Timeout: Second-3600
Connection: Keep-Alive
Content-Length: 199
Host: webdavserver:7161

<?xml version="1.0" encoding="utf-8" ?><D:lockinfo xmlns:D="DAV:"><D:lockscope><D:exclusive/></D:lockscope><D:locktype><D:write/></D:locktype><D:owner><D:href>DOMAIN\user</D:href></D:owner></D:lockinfo>

Response 2

HTTP/1.1 207 Unknown
Date: Wed, 05 Nov 2014 11:45:32 GMT
Content-Length: 307
Content-Type: text/xml; charset=UTF-8
X-Powered-By: Servlet/2.5 JSP/2.1

<?xml version="1.0" encoding="utf-8" ?>
<D:multistatus xmlns:D="DAV:"><D:response><D:href>http://tidevwls03:7161/OpenTwinsApp/WebDAV/577476_Client%2C_3rd_party_or_internal_account._Rheiner_R%C3%BCckversicherungs_GmBH1.doc</D:href>
<D:status>HTTP/1.1 423 Locked</D:status>
</D:response>
</D:multistatus>

Request 3

GET http://webdavserver:7161/App/WebDAV/577476_Client%2C_3rd_party_or_internal_account._Rheiner_R%C3%BCckversicherungs_GmBH1.doc HTTP/1.1
Connection: Keep-Alive
Content-Type: text/xml; charset="utf-8"
User-Agent: Microsoft Office Core Storage Infrastructure/1.0
Depth: 0
Translate: f
Connection: Keep-Alive
Host: webdavserver:7161

Response 3

HTTP/1.1 200 OK
Date: Wed, 05 Nov 2014 11:45:32 GMT
Transfer-Encoding: chunked
Content-Type: application/msword
Last-Modified: Wed, 05 Nov 2014 11:45:30 GMT
ETag: W/"77312-1415187930429"
X-Powered-By: Servlet/2.5 JSP/2.1

[byte stream]

Request 4

PROPFIND http://webdavserver:7161/App/WebDAV/577476_Client%2C_3rd_party_or_internal_account._Rheiner_R%C3%BCckversicherungs_GmBH1.doc HTTP/1.1
Cache-Control: no-cache
Connection: Keep-Alive
Pragma: no-cache
Content-Type: text/xml; charset="utf-8"
User-Agent: Microsoft Office Core Storage Infrastructure/1.0
Depth: 0
Translate: f
Connection: Keep-Alive
Content-Length: 208
Host: webdavserver:7161

<?xml version="1.0" encoding="utf-8" ?><D:propfind xmlns:D="DAV:" xmlns:Office="urn:schemas-microsoft-com:office:office"><D:prop><D:creationdate/><D:getlastmodified/><Office:modifiedby/></D:prop></D:propfind>

Response 4

HTTP/1.1 207 Unknown
Date: Wed, 05 Nov 2014 11:45:33 GMT
Content-Type: text/xml; charset=UTF-8
X-Powered-By: Servlet/2.5 JSP/2.1

<?xml version="1.0" encoding="utf-8" ?>
<D:multistatus xmlns:D="DAV:"><D:response><D:href>http://tidevwls03:7161/OpenTwinsApp/WebDAV/577476_Client%2C_3rd_party_or_internal_account._Rheiner_R%C3%BCckversicherungs_GmBH1.doc</D:href>
<D:propstat><D:prop><D:creationdate>2014-11-05T11:45:30Z</D:creationdate>
<D:getlastmodified>Wed, 05 Nov 2014 11:45:30 GMT</D:getlastmodified>
</D:prop>
<D:status>HTTP/1.1 423 Locked</D:status>
</D:propstat>
<D:propstat><D:prop><modifiedby xmlns="urn:schemas-microsoft-com:office:office"/></D:prop>
<D:status>HTTP/1.1 404 Not Found</D:status>
</D:propstat>
</D:response>
</D:multistatus>

From this point on Microsoft Word appears to poll the server attempting to acquire a lock on the document. The user is still unaware there is a lock on the document. I think this proves that Word is aware of the lock.

Request 5

LOCK http://webdavserver:7161/App/WebDAV/577476_Client%2C_3rd_party_or_internal_account._Rheiner_R%C3%BCckversicherungs_GmBH1.doc HTTP/1.1
Cache-Control: no-cache
Connection: Keep-Alive
Pragma: no-cache
User-Agent: Microsoft Office Core Storage Infrastructure/1.0
If: (<>)
Translate: f
Timeout: Second-3600
Connection: Keep-Alive
Host: webdavserver:7161

Response 5

HTTP/1.1 207 Unknown
Connection: close
Date: Wed, 05 Nov 2014 11:46:07 GMT
Content-Length: 307
Content-Type: text/xml; charset=UTF-8
X-Powered-By: Servlet/2.5 JSP/2.1

<?xml version="1.0" encoding="utf-8" ?>
<D:multistatus xmlns:D="DAV:"><D:response><D:href>http://tidevwls03:7161/OpenTwinsApp/WebDAV/577476_Client%2C_3rd_party_or_internal_account._Rheiner_R%C3%BCckversicherungs_GmBH1.doc</D:href>
<D:status>HTTP/1.1 423 Locked</D:status>
</D:response>
</D:multistatus>

Upvotes: 1

Views: 2140

Answers (2)

mrswadge
mrswadge

Reputation: 1749

From Julian Reschke's answer and the comment to utilise Litmus to test the WebDAV server, I was able to find an answer.

Response 2 has problems:


The 207 Multi-Status HTTP response status is not supported by Microsoft Word when the LOCK command is issued to the WebDAV server. Instead a response issuing a 423 Locked response code should be given. The body of the response should be blank.

The following response worked.

HTTP/1.1 423 Unknown
Date: Wed, 05 Nov 2014 16:57:57 GMT
Content-Length: 0
X-Powered-By: Servlet/2.5 JSP/2.1

And the end result was a dialog in MS Word looking as follows.

The file is locked for editing by another user.

Upvotes: 1

Julian Reschke
Julian Reschke

Reputation: 42017

Response 2 has multiple problems:

Upvotes: 1

Related Questions