0

Is it possible to take a webpage snapshot of a non-public facing website (intranet) using the OneNote API?

I'm using the OneNote API to create OneNote notebooks, pages and sections. It's working well. Unfortunately, when I use data-render-src and point it to an intranet website, it fails to take a snapshot. The application is on the same intranet as the website I wish to capture.

Example HTML:

<!DOCTYPE html>
<html>
  <head>
    <title>A page with an image: Webpage capture zzzz</title>
    <meta name="created" value="2015-11-11T12:45:00.000-8:00"/>
  </head>
  <body>
    <p>This page displays an image of the webpage.</p>
    <img data-render-src="https://intranet.website.com" width="800"/>
  </body>
</html>

Note: I can take snapshots of publicly accessible websites.

Webpage snapshot description https://learn.microsoft.com/en-us/graph/onenote-images-files#add-a-webpage-snapshot

Image rendered from html description https://learn.microsoft.com/en-us/graph/onenote-images-files#add-an-image-rendered-from-html

DeanB_Develop
  • 2,107
  • 3
  • 23
  • 37

1 Answers1

1

I don't think it is - the OneNote aPI server will not have access to that page because it isn't public. You'll have to extract the HTML and send it over through the API instead of using data-render-src.

Jorge Aguirre
  • 2,787
  • 3
  • 20
  • 27
  • Thanks @Jorge-Aguirre. Last ask: Are there permission settings in Azure Active Directory to change snapshot permission? Note: HTML formatting can be a bit tricky. We're using an Angular application. I'm thinking of creating an internal snapshot middle-tier (`NodeJS` + `Puppeteer`) base64 the images and send it instead of complex `HTML`. Have you seen something like this used before? – DeanB_Develop Feb 11 '19 at 23:04
  • If the URL is publicly accessible, then the snapshot will work, but if it isn't (like an intranet page) then it won't. How does the Azure Active Directory permission settings come into play here? I definitely understand what you mean - have you considered using a solution that runs client side and gives you the HTML of the current page as an image? There are plenty of libraries that do this, like for example: https://www.npmjs.com/package/dom-to-image – Jorge Aguirre Feb 11 '19 at 23:41
  • 1
    Thanks for the clarification. I wasn't sure if `Azure Active Directory` had a consent scope for snapshots like ['User.Read', 'notes.create', 'notes.readwrite'] ... I'll look into the libraries. Unfortunately, we're still supporting `IE11` – DeanB_Develop Feb 12 '19 at 00:27