How do I create links to documents using Office URI Schemes?

You can create links to documents in SharePoint based on how you want the documents to be opened (View document, Edit document or New document from template). The syntax that you have to use is:
[Scheme-name]:[Command-name]|u|[Command-argument-1]

Examples:

  1. To view a document:
    ms-word:ofv|u|https://contoso/documents/budget.docx
  2. To create a new document from template:
    ms-word:nft|u|https://contoso/templates/budget.dotx

Explanation of the different parts in the syntax:

  1. “Scheme-name” refers to the type of application that should be invoked. The options are:
    1. MS Word: ms-word
    2. MS PowerPoint: ms-powerpoint
    3. MS Excel: ms-excel
    4. MS Visio: ms-visio
    5. MS Acess: ms-access
    6. MS Project: ms-project
    7. MS Publisher: ms-publisher
    8. MS SharePoint Designer: ms-spd
    9. MS InfoPath: ms-infopath
  2. “Command-mame” refers to how the document should be opened. The options are:
    1. View Document: ofv
    2. Edit Document: ofe
    3. New Document from Template: nft
  3. “Command-argument-1” defines the URL to the document. The maximum path length is 256 characters for all apps except Excel, where the limit is 216.

A simple way to create a URI link for a document is:

  1. Select the document and click on the “Open in” function, on the horizontal toolbar:
    Open a document in
  2. In the dialog window that pops-up, right-click the “Open in app” button and select the “Copy link” option:
    Copy link to URI scheme
  3. The copied link will be something like this:
    ms-word:ofv|u|https://contoso/documents/budget.docx
  4. Now, the only thing you need to do is to eventually change “ofv” to either “ofe” (if you want to edit the document) or to “nft” (if you want to create a document from template).

Note

  1. Previously, it was also possible to define the default location to where files should be saved to, when creating a document from a template. Unfortunately this is not supported any more and Microsoft has no plans to fix this. The URI syntax for this was:
    [Scheme-name]:[Command-name]|u|[Command-argument-1]|s|[Command-argument-2]
    Where “Command-argument-2” defined the URL to the default folder where the files should be saved to.
  2. Further information about Office URI Schemes can be read on this page.