Making Microsoft Office to Work with WebDAV Server
Microsoft Office can open files from WebDAV server and save them back to the server without the need to download them to local file system. To achieve this the following conditions must be met:
-
Your WebDAV server must be configured on the site root. Microsoft Office submits OPTIONS and PROPFIND requests to site the root (http://server/) and requires the server to respond properly. If your WebDAV server is non-root (for example http://server/dav/) Microsoft Office will open documents as read-only.
-
Your WebDAV server must support Class 2. Microsoft Office locks documents when creating and opening files for editing. If Microsoft Office is unable to lock the document it will be opened as read-only.
Note that this will only enable Microsoft Office to open files from WebDAV server via Microsoft Office 'Open' menu or starting a Microsoft Office application passing a document URL as a parameter. Hyperlinked documents will still open as read-only.
Opening Web-hyperlinked Microsoft Office documents in read-write mode
If you click on a hyperlink on a web page in a browser Microsoft Office will open a document as read-only. This is a default Microsoft Office behavior. To open a document in read-write mode you can use one of the following approaches:
-
Add OpenDocumentsReadWriteWhileBrowsing DWORD Value on a client machine under the key
HKEY_CURRENT_USER\Software\Microsoft\Office\<version>\Common\Internet.
Set the Value data to 1. -
Use SharePoint.OpenDocuments ActiveX in a client JavaScript:
See OpenDocuments Control about how to use it at Microsoft website.
The SharePoint.OpenDocuments ActiveX is located in OWSSUPP.DLL and installed with Microsoft Office 2007.
Why Microsoft Office still open my document as read-only?
Here are some troubleshooting tips if Microsoft Office files open as read-only from a WebDAV server.
- Clear Microsoft Office WebDAV cache in the registry. Microsoft Office reads WebDAV server options when connecting to server first time and stores them for later use. If your server settings have changed during development (or you just fixed some server issues) you may need to delete these settings. The Microsoft Office WebDAV cache is stored under the key:
HKEY_CURRENT_USER\Software\Microsoft\Office\<version>\Common\Internet\Server Cache\
To clear cache just delete all keys under this key. In a development environment, we suggest always clearing the cache if your WebDAV server class has changed or after authentication scheme has changed. As an alternative to deleting cache, you can just reconfigure your server to run on a different port.Note that in the production environment usually you do not need to clear this cache or change the port as soon as you server settings do not change often while Microsoft Office will re-request server options after some time.
-
Examine the server log for exceptions. Before opening the document from WebDAV server, Microsoft Office submits LOCK request. This request must succeed, otherwise the document will be opened as read-only. Depending on Microsoft Office version, operating system it may submit a bunch of other requests. Check your server log and make sure all requests were successful.
-
Examine WebDAV requests with a Fiddler tool. While all requests that reached the WebDAV server Engine are logged, if the request failed before hitting the Engine you will not see it in a log. Usually, this happens if the request failed during authentication stage. In this case use the free Fiddler tool or any other debugging proxy to examine the requests.
Note that to capture the requests in Internet Explorer using Fiddler you have to use computer name (such as http://myworkstation/) instead of http://localhost/ or http://127.0.0.1/.
-
Exclude client side MS Office issues. Finally, there could be issues with Microsoft Office installation or components registration. Use our demo WebDAV server (or any Class 2 WebDAV server sample provided with SDK) to open, edit and save MS Office documents. Open www.ajaxbrowser.com in Internet Explorer on a computer with MS Office 2007 installed, then right-click on Microsoft Office document in files list pane and select Edit command in context menu. Select OK in the File Download warning popup window. The document should open in read-write mode and you can click Save button on a toolbar to save the document directly to the server.
Microsoft Office Authentication
Important! Microsoft Office 2010 requires secure SSL connection when used with Basic authentication, it will fail to open a document via an insecure connection with Basic authentication. For a workaround please see this article: You cannot open Office file types directly from a server that only supports Basic Authentication over a non-SSL connection with Office 2010 applications.
Microsoft Office applications always ask for the authentication when used with Basic and Digest authentication. If you check "Remember my password" checkbox it will still display the login dialog, but the username and password will be already filled in, so you just click "OK". If NTLM or Kerberos is used than MS Office asks for credentials only 1 time during first document access.