OfficeDev / office-js

A repo and NPM package for Office.js, corresponding to a copy of what gets published to the official "evergreen" Office.js CDN, at https://appsforoffice.microsoft.com/lib/1/hosted/office.js.
https://learn.microsoft.com/javascript/api/overview
Other
681 stars 95 forks source link

OneNote: Fetching contents of non-active page #1373

Closed msiemens closed 4 years ago

msiemens commented 4 years ago

Expected Behavior

Using the OneNote API to fetch the page contents of a non-active page should succeed.

Current Behavior

An error is thrown:

RichApi.Error: Accessing page contents of inactive page is not allowed

Either this error should not happen or – if intended – this should be documented in the OneNote API documentation.

Steps to Reproduce

const section = context.application.getActiveSection();
section.pages.load();
await context.sync();

const page = section.pages.getItem(5); // In this example the page with index 5 is NOT active
page.contents.load();
await context.sync();

page.contents.load();

Your Environment

AlexJerabek commented 4 years ago

Thanks for reporting this @msiemens.

@JuaneloJuanelo, could you please help investigate this OneNote issue or find the right owner?

ElizabethSamuel-MSFT commented 4 years ago

@msiemens The OneNote page does need to be active for fetching page content to succeed - see https://docs.microsoft.com/office/dev/add-ins/onenote/onenote-add-ins-page-content#accessing-page-contents.

If you would like to see support added for getting the content of non-active OneNote pages, please upvote or request a feature on UserVoice.

Thanks.