Integrate SharePoint Documents with Office Web Apps in Custom Solutions

If you are finding way of integrating Office Web Apps(OWA)with your custom solution which built with SharePoint CSOM/ JSOM or with integration of any client site development. Specially in a scenario where you develop your own “SharePoint display template” following integration points will be useful;

View in office web apps

Following link will work; if your requirement is to open your document in OWA. This can be done with simply appending parameter as below;

<uri to your document>?Web=0

Eg:
http://mydomain.local/sites/OWASite/Documents/TechCentro.docx?Web=0

Edit SharePoint documents in OWA

Following way of integration with the Office Web apps which let you to pick your action is; means that whether your action may be read, edit or your default setting.

<Web absolute URi>_layouts/15/WopiFrame.aspx?sourcedoc=<Relative URi to document>&action=<Your action>

Summary of actions as below;

 

&action=default -> Gets default setting of the documents
&action=view    -> Open office app as a read only
&action=edit    -> Open office app as editable

Eg:

http://mydomain.local/sites/OWASite/_layouts/15/WopiFrame.aspx?sourcedoc=/sites/OWASite/Documents/BestPractices.docx&action=edit

You can be changed the default behavior with following approach
https://technet.microsoft.com/en-us/library/ee837425.aspx?f=255&MSPPError=-2147217396

Building URL to the Office Web Apps

If you thinking about how to build your URL; following illustration may be useful.

var owauri="_spPageContextInfo.webAbsoluteUrl" //absolute URL of the SharePoint site
+"/_layouts/15/WopiFrame.aspx?sourcedoc=" //static phrase
+"/sites/OWASite/Documents/TechCentro.docx" //Relative URL to the document
+"&action=edit //Action parameter

Useful resources

https://technet.microsoft.com/en-us/library/ff431685.aspx

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s