Page 1 of 1
Open Related Document in Client Application
Posted: 02 Oct 2018
by TonyDuke
Good Afternoon,
We have a related item view on a display form that displays word documents. We need these word documents to open in the client application as opposed to Word Online. From the Document Library itself they open in the Client Application, but this doesn't seem to pass through to the related item view.
We don't want to download a copy of the file so simply having a HTML Link won't work as the document needs to save back to the SharePoint list...
How can we implement the above please??
Thanks
Re: Open Related Document in Client Application
Posted: 02 Oct 2018
by AlexZver
Hi!
Related documents provide the same behavior in part of opening web apps or client apps as regular list views. That behavior can be configured for the whole site collection, not a certain form or related items control.
Please, check this Microsoft Community forum topic:
https://answers.microsoft.com/en-us/mso ... a1b?auth=1
Re: Open Related Document in Client Application
Posted: 04 Oct 2018
by TonyDuke
Hi Alex,
Unfortunately this does not seem to be the case, our Site collection is set to open documents in the client app, however this functionality only seems to work in I.E and not in Chrome, and due to other restrictions in I.E our users all use Chrome. I do have an open case with Microsoft and they are looking into this, however in the meantime I need a fix for the issue...
What I am thinking is something along the lines of hijacking the link and adding "ms-word:ofe|u|" to the beginning of the URL string to force the document to open in the client app, I just need a little help with the right way of doing this if possible??
Thanks
Re: Open Related Document in Client Application
Posted: 04 Oct 2018
by TonyDuke
Hi Alex,
I have resolved this issue with the following code: -
Code: Select all
$('.ms-vb2 a').click(function() {
var documentURL = $(this).attr('href');
documentURL = 'ms-word:ofe|u|'+documentURL;
window.location.href = documentURL;
});
Not sure if you can see any issues with this but it seems to be working ok at the moment...
Thanks
Re: Open Related Document in Client Application
Posted: 04 Oct 2018
by AlexZver
Hi!
I'm really glad you've found a solution, great work! It's a tricky issue, I'm sure your solution will be helpful for all community.
Re: Open Related Document in Client Application
Posted: 14 Aug 2019
by andyb
This no longer appears to work for me in Classic Forms Designer, although I'm sure it did at some point (or I'm going mad!).
Can anyone suggest an alternative?
Kind regards
Andy
Re: Open Related Document in Client Application
Posted: 15 Aug 2019
by mnikitina
Hello andyb,
Please check how the related items control renders, depending on this you need to use a different element name in the code, as DOM may differ depending on the rendering mode.

- render.PNG (8.12 KiB) Viewed 7754 times
If it renders on the
client-side you need to use the below code.
Code: Select all
$('.ms-listlink').click(function(){
var documentURL = $(this).attr('href');
documentURL = 'ms-word:ofv|u|'+documentURL;
window.location.href = documentURL;
});
If it renders on the
server-side use $('.ms-vb a') in the code.
Note, that to make the code work you need to enable opening documents in client applications in Site collection features. Please see how to enable it in the
instructions at Microsoft site.