Call Us At: 701.866.2098

Force Files to Open with Microsoft Apps When Sharing Links Using URI Schemes


URI schemes allow for office productivity applications to be invoked with various commands. Each application is given a different named scheme but all schemes follow the same rules for how the URI is formed (URI Schema).

Full schema

< scheme-name >:< command-name >”|”< command-argument-descriptor > “|”< command-argument >

The scheme syntax includes the following:

1. < scheme-name >: This refers to the type of application that should be invoked. For instance, the ms-word: scheme name is registered by Microsoft Word.

2. “:” separator

3. < command-name >: This describes the actions that the application should perform. For instance, opening a document for viewing. The list of command names is described in section 1.5.

4. “|” (vertical bar) separator

5. < command-argument-descriptor >: This element gives more information about what the command argument is about.

6. “|” (vertical bar) separator

7. < command-argument >: The arguments vary depending on the command. One common argument is the URI to a document, typically using the http or https scheme. Note that within < command-argument > segments the RFC 3986 reserved characters “:” and “/” are part of the argument data, not delimiters, and are therefore included unescaped.

Abbreviated schema

An abbreviated form of the office URI schemes allows for a more compact request to launch a specified Office application to open the resource located at a given URI. This abbreviated form implies the < command-name > “ofv” and the < command-argument-descriptor > “u”. No further commands or command arguments are allowed in this schema.

< scheme-name >:< command-argument >

1. < scheme-name >: the type of application that should be invoked. For instance ms-word: for Microsoft Word.

2. < command-argument >: URI for the resource the application should open. Currently only URIs based on the http or https scheme are supported.

Examples of Use

Microsoft Excel File
Sharepoint’s default shared link is:

https://sharepoint.com/shared/YOUR_EXCEL_DOCUMENT.xlsx?Web=1

change to:

ms-excel:ofe|u|https://sharepoint.com/shared/YOUR_EXCEL_DOCUMENT.xlsx

Microsoft Word File
Sharepoint’s default shared link is:

https://sharepoint.com/shared/YOUR_WORD_DOCUMENT.docx

Change to:

ms-word:ofe|u|https://sharepoint.com/shared/YOUR_WORD_DOCUMENT.docx

5 Comments

  1. Chris

    Reply

    Very clearly explained, with concise examples — thank you!

    Do you know if only SharePoint links will work with the URI Scheme to open files in a specified Office program? I’m trying to use this functionality to open a CSV I’m serving, and the best I’ve been able to do is to open a file in read-only mode. (For context, I’m on a Mac, using Office for Mac v16.23)

    • Reply

      Thanks for the compliments, Chris. Is this similar to what you’ve tried with your CSV:
      ms-excel:ofe|u|https://YOURSITE.com/assets/YOURFILENAME.csv

      The URI scheme should work outside of SharePoint.

  2. Joe McGiven Corban

    Reply

    Hi Trav – about this…

    “: This element gives more information about what the command argument is about”

    All I can see is |u| – are there no others? what does |u| mean? All seem to have that, so perhaps it stands for “U”RI?
    ms-excel:ofe|u|https://sharepoint.com/shared/YOUR_EXCEL_DOCUMENT.xlsx

    Thanks

  3. Reply

    In a recent Office 365 Monthly Channel update, Microsoft has given users the ability to control where Office documents open in their default behavior. Users can apply a change to make it so Excel, Word, PowerPoint files that are stored in OneDrive, SharePoint, or Outlook open in their desktop app by default. If users prefer to have files open in the online application, no action needs to be taken. To make the this change, go to File Options Advanced Link Handling in any Office 365 desktop application and check the box next to “Open supported hyperlinks to Office files in Office desktop apps”

  4. Jemi

    Reply

    FYI.
    Using URI Schemes to force open documents in desktop application prevents co-authoring.

Leave a comment

Your email address will not be published. Required fields are marked *