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

  • 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? – suril patel Aug 24 '17 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 Aug 24 '17 at 13:38
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]

  • 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 Sep 16 '14 at 2:35
2
+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
    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 Nov 30 '17 at 8:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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