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 (read-only mode, edit mode or create a document from a template). The syntax that you have to use is:
[Scheme-name]:[Command-name]|[Command-argument-descriptor-1]|[Command-argument-1]|[Command-argument-descriptor-2]|[Command-argument-2]

Examples:

  1. To view a document:
    ms-word:ofv|u|https://contoso/documents/budget.docx
  2. To create a new document from template and have a default location to where the file should be saved to, this used to be the syntax, but since of lately the second part of this argument does not work (the default saving location):
    ms-word:nft|u|https://contoso/templates/budget.dotx|s|https://contoso/documents/

Explanation of the different parts in the syntax:

  1. “Scheme-name” refers to the type of application that should be invoked. They 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” is mandatory and 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-descriptor-1” is mandatory. This element gives more information about what the command argument is about. The value to use:
    u
  4. “Command-argument-1” is mandatory and normally the URL to the document. The maximum path length is 256 characters for all apps except Excel, where the limit is 216.
  5. “Command-argument-descriptor-2” is optional and used when creating a new document from template and when you want to define the URL to the default folder that the file should be saved to. The value to use:
    s
  6. “Command-argument-2” is optional and defines the URL to the default save location, when creating a new document from template. The maximum path length is 256 characters for all apps except Excel, where the limit is 216.

Further information about Office URI Schemes can be read on this page.