How to integrate Sharepoint Online Webpart File Preview into external application by using WOPI Url. RRS feed

  • Question

  • Hi,

    I'm trying to integrate the Powerpoint and PDF Preview of a Webpart into an external application.

    I'm loading the page using the Sharepoint Online REST API and and as part of the Canvas1, SharePoint is returning the Webpart containing the wopiurl for the embedded document.

    I'm trying to load the content of the wopiurl by sending a request (GET) including the Sharepoint Online OAuth2 Bearer access token as Header (server to server).


    SharePoint Online is returning a response with HTTPStatus 401.

    If I load the url directly in the browser everything works. The request will be redirect to:


    => Make sense as I'm looked into Sharepoint Online/Office 365.

    Do I have add an WOPI accesstoken like decribed in the following links?

    Can I create a new access token for WOPI by exchanging/using my existing OAuth2 Access Token?

    Is there an REST API to generate the access token for SharePoint Online?



    • Edited by pheinzelmann Thursday, October 10, 2019 12:11 AM Updated
    Thursday, October 10, 2019 12:02 AM

All replies