19

Let's suppose that I have WebDAV-enabled server, where I have bunch of Office documents. I'd like to generate webpage which has link to document such that clicking on the link will open Microsoft Word. Word will in turn download document from WebDAV server, and when user finishes editing document, MS Word will upload it back.

I know that MS Word (and other Office programs) support editing of documents stored on WebDAV server. What I don't know, is how to generate link which will trigger MS Word to download this document by itself.

Is it possible? Maybe using some special scheme?

Oli4
  • 489
  • 1
  • 9
  • 22
Peter Štibraný
  • 32,463
  • 16
  • 90
  • 116

4 Answers4

67

Ummm, you could also use something like this:

<a href="ms-word:ofe|u|http://some_WebDav_enabled_address.com/some_Word_document.docx">Open Document in Word</a>

The difference from the above answers is that this would no longer require ActiveX and it will work at least in IE 8+, Chrome and Firefox, as long as it is opened from a Windows machine, for Office 2010+ (not 100% sure about this one though).

Explanation: the ms-word:ofe part is a protocol that gets installed on the client machine when Office is installed. I don't know exactly what the |u| part does.

Julian
  • 33,915
  • 22
  • 119
  • 174
gciochina
  • 1,182
  • 16
  • 23
  • 6
    This is the only sensible solution nowadays and should be the accepted answer. The u is the argument descriptor btw and contains further information about the command (ofe - 'open for edit' in this case). As far as I know it is always u, though. – bstenzel Mar 04 '16 at 13:19
  • 11
    It's documented here: https://msdn.microsoft.com/en-us/library/office/dn906146.aspx – David K. Hess Mar 10 '17 at 00:15
  • 1
    Here is an up-to-date documentation on URL schemes for invoking MS Office apps: http://wopi.readthedocs.io/projects/officewopi/en/latest/scenarios/from_app.html – Alex Klaus Feb 15 '18 at 04:53
  • Thanks for the answer. How to open two word documents using the same "href"? – Sathish Feb 28 '19 at 11:42
  • The "ofe" - edit part of the URI schemes seems to no longer work. It's always opened in view only mode now. – marvc1 Dec 14 '22 at 17:18
  • it seems TLS is now mandatory in ms-word, I wasn't able to open a document from my webdav server using a "HTTP" URL, I had to use "HTTPS" instead. There was no error, just a gray screen after Word startup. – bN_ Apr 27 '23 at 10:20
11

Confluence uses the EditDocument method of the SharePoint.OpenDocuments ActiveX control.

Example in Javascript:

new ActiveXObject("SharePoint.OpenDocuments.1").EditDocument("http://example.com/test.doc")
rjmunro
  • 27,203
  • 20
  • 110
  • 132
Arne
  • 596
  • 5
  • 9
6

As far as I recall, the only way to achieve this is to explicitly instantiate Word through ActiveX, and the pass it the URL to open.

This can be done inside the HTML page (in which it'll need IE), or using an external application that then would need to be registered for a new mime type (see http://greenbytes.de/tech/webdav/rfc4709.html#rfc.section.B.1 for an example).

Julian Reschke
  • 40,156
  • 8
  • 95
  • 98
  • Julian, as a spec author, you probably know if there are any clients supporting Mounting Webdav Servers out of the box? – Peter Štibraný Mar 23 '09 at 15:28
  • 1
    The Xythos client does. And the spec already contains the code to make it happen with the Microsoft webfolder client, It would be nice to have a matching implementation for MacOS X; shouldn't be too hard... – Julian Reschke Mar 24 '09 at 07:44
0

I found that Confluence can do this. They have special Firefox plugin, but it should work fine with Internet Explorer.

In fact, when I started to play with it, it turned out that IE does actually opening document directly from WebDAV. It seems like if IE downloaded the page, passed it to MS Word, but together with URL. MS Word can then save file back (well, sometimes it sees the file as read-only, and doesn't allow to save back, but allows to upload under different name).

Still investigating.

Peter Štibraný
  • 32,463
  • 16
  • 90
  • 116
  • When you say "sometimes it sees the file as read-only" did you get anywhere on this? I've posted another question on a similar issue: http://stackoverflow.com/questions/2999450/ms-word-opens-documents-hosted-on-webdav-share-read-only-on-windows-vista-and-7-b – rjmunro Jun 09 '10 at 13:59
  • @rjmunro: unfortunately no ... we didn't use ActiveX/plugins technique for opening MS Word after all. – Peter Štibraný Jun 09 '10 at 20:04