Search code examples
javascriptprintingmicrosoft-graph-apimicrosoft-graph-sdksmicrosoft-graph-files

How can users print whole documents from file preview in Microsoft Graph


We are using graph api in our app to allow users to view files hosted on our SharePoint site.

We can get the files (mainly Word documents) to load fine in a new tab, using the URL format of:

"https://graph.microsoft.com/v1.0/sites/" + siteId + "/drive/items/" + itemId + "/preview"

However, there seems to be no facility to print from here. If you use the browser to print, it will only get the first page of the document.

Is there any way to print the whole document without having to give the users the ability to download a copy first and open it locally?


Solution

  • Use the following request body:

    {
        "viewer":"office",
        "chromeless":false
    }