13

I need to send users a link to a document in via email, where clicking the link should open the document in the client application, not the browser.

I have already configured the library to open documents in the client application, and this works fine when clicking on the file in the library. However, using the "copy a link" button to get a link to the file and pasting it into a new browser tab opens the file in the browser, not the client.

1
  • 4
    You could try to format the copied URL like this: ms-word:ofe|u|DOCURL.doc. This works for <a> tags. Since eMails are essentially html this should work for you too.
    – Mx.
    Commented Jun 28, 2017 at 13:41

6 Answers 6

19

Mx had the right answer, but I wanted to post the full solution and a few more details in case anyone else is trying to do this:

If you use the "copy url" feature in the library, you get a url like this (depending on the options selected):

https://someurl.sharepoint.com/sites/site1/_layouts/15/DocIdRedir.aspx?ID=TAKVH6VDTJ5Q-572621523-17

From my testing, the above never opens in the client.

However, the following will open in the client:

https://someurl.sharepoint.com/sites/site1/Shared%20Documents/WordDoc1.docx

Mx suggested using the following:

ms-word:ofe|u|https://someurl.sharepoint.com/sites/site1/Shared%20Documents/WordDoc1.docx

This seems to work even smoother, as the one above will prompt the user, asking them if they want to open the file, while Mx's url just opens immediately. I'm sure there are security implications with this, so test accordingly.

Of course, the one drawback with this is that there is nothing in the GUI that I'm aware of that allows us to get these urls, and they will have to be created manually.

5
  • 2
    Here's some additional reference for the URI schemes: msdn.microsoft.com/en-us/library/office/dn906146.aspx
    – Mx.
    Commented Jun 28, 2017 at 14:14
  • hey @Mx. - sorry for the necro, but hoping you can help me out. I tried using the ms-word:ofe|u| prefix in Sharepoint recently, and it gave me an error stating it was invalid. any thoughts on what's going wrong? Commented May 9, 2020 at 23:51
  • 1
    hey @acousticismX, there could be plenty of reasons. Maybe check again if your url is valid (correct path, etc.). If that does not help try to ask a question. Also you could check how SharePoint does this itself (F12 Dev-Tools) .
    – Mx.
    Commented May 14, 2020 at 13:42
  • 1
    Here is a link that describes the "ms-word:ofe|u|" docs.microsoft.com/en-us/office/client-developer/…
    – Dbloch
    Commented Sep 30, 2021 at 13:45
  • @acousticismX, the SharePoint hyperlink type column simply won't allow you to start a URL with the ms-word:ofe|u| prefix, which is why it complains of an invalid URL.
    – DRVR
    Commented Feb 9, 2022 at 22:58
4

Adding to Mike2500's answer (as an answer since I can't comment yet):

Of course, the one drawback with this is that there is nothing in the GUI that I'm aware of that allows us to get these urls, and they will have to be created manually.

Indeed there is a way to derive the direct link to a sharepoint-hosted document: When you open the file in the local client, and then navigate to File => Info, there's a button labeled "Copy path". Clicking that will copy the exact path to your clipboard.

enter image description here

1
  • This is great except that it adds the parameter web=1 at the end. This must be removed to achieve the desired result (open in app). Commented Jan 18, 2022 at 17:58
2

"...there is nothing in the GUI that I'm aware of that allows us to get these urls, and they will have to be created manually."

I use the 'export to excel' for the library which then provides the direct link for each document in the library. I too wish there was an easier way.

2

Okay a realise this is an old thread, and Microsoft might have changed things since then, but I tried following the instructions above and found adding a link into an email containing ms-word:ofe|u| causes this message to pop up when the link is clicked

enter image description here

1

to get the full correct path of a document in sharepoint..

  1. navigate to the document
  2. select the burger bar (3 dots) to the right of the filename
  3. select 'details' at the bottom of the list
  4. (on the right an info panel appears)
  5. select 'more details' at the bottom of the info panel
  6. select the 'copy' icon to the right of the word Path
0

Seems to me that appending ?web=0 to the Sharepoint URL of the file does the trick. Must admit a very limited amount of testing on this, though.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.