0

Office JS API for OneNote... Love it, but I am missing some critical things. Can someone comment?

I got a paragraph, type is RichText. But, I could not find in the API the style of the rich text. In my case, I want to know if it is a Header 1,2,3... or Quote, etc.

Same-page linking: In OneNote desktop I can right click any text and copy link to that specific paragraph. Clicking that link later will take me directly to that paragraph. However, I did not find an API that can navigate directly to a paragraph, the only one I could find navigates to a page: navigateToPage(page: Page) and navigateToPageWithClientUrl(url: string) If that even possible? Also, I noticed these links don't work at all in the web version of OneNote, but that's a different story I guess.

I am building (a free!) TOC add-in, you can put at the top of your page and will potentially show all headers with links to the header in the page. However, the lack of the above capabilities make it impossible for such a simple add-in to work (or, at least I thought it is a very basic and simple one...)

Any help will be greatly appreciated!!! Like I said, if I get these 2 issues resolved - the add-in will be available for free.

https://dev.office.com/reference/add-ins/onenote/paragraph?product=onenote

Shai Petel
  • 188
  • 11

2 Answers2

0

Sounds like a cool add-in!

You can use the getHtml method on richText to get the style. There is an example in this answer.

OneNote Add in: Getting HTML content

As for creating links to a specific paragraph, OneNote add ins do not expose the capability of doing that. You can add a request in our uservoice. The only supported capability is to navigate to a page.

https://onenote.uservoice.com/forums/245490-onenote-developer-apis

As for links that work in OneNote online, the "webUrl" property in a page will contain a link that works in OneNote online.

https://github.com/OfficeDev/office-js-docs/blob/master/reference/onenote/page.md

Community
  • 1
  • 1
Jorge Aguirre
  • 2,787
  • 3
  • 20
  • 27
  • 1. GetHTML - very cool! Why isn't that method in the API documentation? 2. Added user voice: https://onenote.uservoice.com/forums/245490-onenote-developer-apis/suggestions/17694163-link-to-specific-paragraph For now, is there an API instead that can scroll the page? (Manually scroll an object into view, or scroll to specific coordinates?) – Shai Petel Jan 11 '17 at 17:10
0

Thanks for feedback. We will update the documentations. There is currently no way to scroll to any region in the page.

simobee
  • 21
  • 1