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.

Mike2500
  • 8,060
  • 4
  • 23
  • 42

5 Answers5

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.

Mike2500
  • 8,060
  • 4
  • 23
  • 42
  • 2
    Here's some additional reference for the URI schemes: https://msdn.microsoft.com/en-us/library/office/dn906146.aspx – Mx. Jun 28 '17 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? – acousticismX May 09 '20 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. May 14 '20 at 13:42
  • 1
    Here is a link that describes the "ms-word:ofe|u|" https://docs.microsoft.com/en-us/office/client-developer/office-uri-schemes – Dbloch Sep 30 '21 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 Feb 09 '22 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

Ascendor
  • 41
  • 2
  • 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). – THE JOATMON Jan 18 '22 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

Terry
  • 21
  • 1
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