16

I'm working on a javascript front end site to run in the browser [Chrome], and I'd like to launch Word on the clients PC with their selected macros that have already been setup in Word for them on their pc.

My questions is does Office [and Word] create an Application URL Protocol [MSDN how to article] for itself when installing it?

For example, iTunes does this, with the url 'itmss://itunes.apple.com/us/app/123213213?mt=8' which, if the user has installed iTunes, will prompt them to open it.

Is there a Word equivalent protocol to itmss? Can I pass the macro names to it as parameters?

If there not an equivalent protocol, does anyone know how I might achieve something similar?

Gavin Fitzgerald
  • 396
  • 1
  • 4
  • 14
  • 1
    I don't think such a protocol exists. – edi9999 Apr 10 '14 at 12:02
  • There is no such protocol for Word, but you can create one on Windows-never done it myself, but the necessary information is at http://msdn.microsoft.com/en-us/library/aa767914 . –  Apr 12 '14 at 07:45
  • 5
    crawling through OneDrive htmls, I've come across this "protocol": "ms-word:ofe|u|", it launches an instance of microsoft word and opens the document pointed by , however, I couldn't find any documentation about it yet and couldn't even make it work by myself – leandro koiti Jun 05 '14 at 12:42
  • 1
    They have finally managed to get some documentation out and available from the MSDN site: https://msdn.microsoft.com/en-us/library/office/dn906146.aspx – Hugo Apr 17 '15 at 18:25

2 Answers2

30

You could try to write your link as follows:

ms-word:ofe|u|http://example.com/myTestDocument.docx

Note that this will most likely require you to have a WEBDAV server running, that is capable of interpreting such requests.

The details about what is the meaning of ofe or u can be found in here

This protocol is available starting Microsoft Office 2010 Service Pack 2 (yes, there are service packs for office also).

Raul Luna
  • 1,945
  • 1
  • 17
  • 26
gciochina
  • 1,182
  • 16
  • 23
  • 1
    You can see this in action on OneDrive. Add a .docx document and choose to open it in Word. – Daniel Jan 08 '15 at 11:30
  • 7
    ofe means open-for-edit-cmd, see https://msdn.microsoft.com/en-us/library/office/dn906146.aspx#bk_addresources – mentat Jun 05 '15 at 05:00
  • I have one file on onedrive, but I can't figure out how to build it's URL. The API returns a file object with properties like `upload_location`, `source` and `link`, which are all different URLs. Any ideas? – Christopher Francisco Dec 22 '16 at 14:32
  • Is there a way to autologin with provided username/password? – beatrice Jun 29 '19 at 18:21
  • @beatrice if I recall correctly, you can use the normal http://username:password@host format for basic authentication – gciochina Jul 01 '19 at 10:12
  • I can use it outside the msoffice uri scheme, but once I use it it still asks for username-password. Seems it doesnt use browser cookies and tries to reauthenticate by itself. – beatrice Jul 01 '19 at 11:13
  • This works well with office.js on Windows but I can't get it to work on Mac. Any ideas why? – rtn Nov 17 '20 at 12:01
6

Office 2010 SP2 and above install URI Schemes which you can use from your website. Microsoft has documentation for these available here: https://msdn.microsoft.com/en-us/library/office/dn906146.aspx

There is a protocol for each of the office products. The MS Word protocol is ms-word:<command-name>"|"<command-argument-descriptor>"|"<command-argument>"

You probably want the "open for edit" command which looks like this: ms-word:ofe|u|<document-uri>

Kevin Berridge
  • 6,251
  • 6
  • 41
  • 42