5

I have a client hosted app (written in Javascript) which includes links to documents in a document library on the tenant. If I point the url's straight to the documents, they simply download.

What I want to do is have the document open in the Word client app, just as it does when opening it directly from the document library (with 'open in client' enabled).

Any ideas on how to implement this in the app?

Thanks

2
  • 1
    We have exactly same requirement in our project but instead of SP 2013, we are creating hosted app for SP online. Have you got solution for this? Commented Aug 24, 2017 at 13:03
  • This does not really answer the question. If you have a different question, you can ask it by clicking Ask Question. You can also add a bounty to draw more attention to this question once you have enough reputation. - From Review
    – Gaurravs
    Commented Aug 24, 2017 at 13:38

2 Answers 2

4
+50
<script type="text/javascript" language="javascript">
window.location.href = "ms-word:ofe|u|https://website.sharepoint.com/sites/sitename/Shared%20Documents/1.docx";
</script>

Try this.

1
  • 1
    Thank you! This is genius. I didn't know about the office URI schemes. Now that I know what to look for I found the documentation and even another SO answer. I tested this solution in Chrome, Edge and IE and all just works.
    – eirikb
    Commented Nov 30, 2017 at 8:04
2

I accomplished this by using the following als document link, if the user clicks it the document is opened in the online word viewer. Depending on your server configuration, this might not work for all file types.

[site URL + Library location]/_layouts/WordViewer.aspx?id=[document URL]

1
  • Thanks Marco, but that option opens the document using Word Online (in the browser). I was wanting the document to open in the users local version of MS Word (the client).
    – BStCroix
    Commented Sep 16, 2014 at 2:35

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.