suresh Nil
suresh Nil

Reputation: 1

OData REST API for integrating MS Office

I need to open office documents from my Sensenet client application. My client application is in ReactJs and I need to invoke the document to open in MS office. Is there any OData REST API available for doing the same. Kindly help.

Upvotes: 0

Views: 284

Answers (1)

Miklós Tóth
Miklós Tóth

Reputation: 1511

You have two options:

1. open a file in a desktop MS Office application

There is an action in sensenet that gives you the url for that. First, get the actions for a document, using a request like this:

https://example.com/odata.svc/Root/Content/myworkspace/Document_Library('abcdef.docx')/Actions

You'll get the list of available actions, which is a JSON array containing action properties, for example a url. Look for the action named EditInMicrosoftOffice. If you display the URL of that action and the users clicks on that link, the browser should open the appropriate desktop office app (e.g. Word). You may notice that the format of the url is special (something like ms-word:ofe|u|https://example.com/Root/...). Please do not try to assemble this url manually, use the one that sensenet generated for you.

2. open and edit a file in the browser

This requires Office Online Server to be installed and configured in your environment, and you also need to display an html containing an iFrame that'll display the editor.

A simple host page:

Geting data to display the host page:

https://example.com/odata.svc/Root/Content/myworkspace/Document_Library('abcdef.docx')/GetWopiData

Upvotes: 1

Related Questions