Wednesday, February 4, 2026

Connecting to OneNote in the Cloud with Office 365 APIs

hi my name is Vijay Sharma and I'm a
product manager for Microsoft OneNote
team today in this video I'm going to
talk about OneNote api's for office 365
I will talk about how you can use the
api's and show you a quick demo of an
application that uses one or api's and
see some code behind lastly we will talk
about one or team's roadmap for
developers all right I am very glad to
announce the general availability of
OneNote api's for office 365 starting
today you can now write apps that can
access OneNote notebooks store in
onedrive for business sharepoint site
hosted notebooks and notebooks in office
365 groups now we already have the
consumer version of OneNote api's the
new version of OneNote api's for office
365 brings parity with a consumer api's
this is a great opportunity for
developers the office 365 market is
growing at a very fast pace and these
api's enable developers to build apps
for a vast majority of businesses and
educational institutions that use office
now this is a high-level architecture of
OneNote rest api with one node API you
can use poast
to create notebooks section section
groups and pages you can call get to get
the notebook hierarchy pages and page
content you can also use update and to
update a page and delete a page I will
walk you through each of these api's and
then show you a quick demo of how to use
the api's now before we start looking
looking at the code I just want to give
you a quick reminder that you need to
register your app with office 365 before
using the api's you can find
instructions to register your app and a
connect site a kms
one node and connect 2015 now here is
how you create a page in OneNote this is
a simple HTML that you can post to
create a page in OneNote what you see
here is a body which in this case
contains a header and an image when you
post this HTML to OneNote it will create
a simple page in one node with the title
and the image now one node has an
hierarchical structure you have
notebooks under that here section groves
under the rear sections and then pages
here is how you get the notebook
hierarchy you can use a notebooks
endpoint to get all of the users
notebooks similarly you can use the
section groups endpoint to get all the
section groups of the user and sections
endpoint to get all the sections but if
you want to avoid making a separate
network call to get notebooks and then
sections and section groups you can just
use expand at the very bottom of the
screen to get entire hierarchy in one
network call now here is how you get a
page now when you for getting a page you
can also pass you can also get we can
pass filters to get the most recently
modified pages now to update a page you
first get the page content and passing
the include IDs parameter set to true
what this will do is this will assign an
ID to each element in the content and
then you can use these IDs to update
that element in the page now let's
switch to a demo and see the code in
action alright to demo this api's let's
first look at a business problem I
travel a lot and meet a lot of customers
I exchange business card with the
customers and end up having a lot of
business cards so how can I organize my
business cards I'm going to use my
office lens app to scan a business card
and save it to my notebooks storing
onedrive for business okay I'm going to
use the office lens app to scan the
business card and save it into my
notebook here I scan the business card
and then I save it into my notebook in a
section called business cards I save it
over here now I was already logged into
my office 365 account and this business
card should get saved into my office 365
notebook now let's flip over to my
notebook that I saved this business card
you see there is an image of the
business card and you also see some
useful information like email phone
number etc OneNote actually extracted
this information from my business card
and saved the VCF file in my page this
is very useful information I can then
add my notes to this contact additional
meeting notes and save images right here
in OneNote now let's look at the code in
Visual Studio here's a sample code that
creates a OneNote page using the post
api's first I do and do create an HTTP
client set the default header and set up
the authentication we are going to use
OAuth authentication and set that as a
bearer token here is a simple HTML that
contains the image of the business card
notice that I have a div where I set the
data render method to extract and
provide a source image what this does is
it tells one node to extract useful
information from the image and the API
will analyze the image and see if is a
business card or a recipe or a news
article and extract relevant information
from the image this is very very
powerful now here is the post method of
the HTML now here I post the HTML to a
section in my notebook
by specifying the full URL of the URL
part and a multi-part content with the
HTML and the binary of the image I then
posted a sync and it will create a new
page in OneNote and extract the business
card from the image so this is how you
create content in OneNote
now this stuff was pretty useful but
wait there is more
what else can you do with the content
saved in OneNote what if I want to send
a quick email to one of my contacts
after the meeting so let's switch to
Outlook and see if we can send an email
to my contact now OneNote team build a
sample add-in for Outlook that goes over
all your notebooks sections and pages
and extracts business cards from my
notebooks and shows them as a contacts
right over here so let's fire off this
add-in and it will bring all my contacts
into OneNote so you see all my contacts
are over here and I can start writing
email to my contacts now this
information was very useful
imagine you meet somebody you scan their
business card and put into one node you
can start writing email to them within
five minutes now let's look at the code
behind these api's here is some
JavaScript code to call the OneNote REST
API to get the nose and sections I'm
going to use expand to get all the
notebooks sections and pages in one
network call once I get the pages I want
to get the page content here I call the
page content API and pass in the section
ID and page ID to get the page content
once I get the page content I have
walked through the HTML and see if the
page contains a VCF file as an
attachment if there is an attachment I
extract the email and name from the card
and show it in my user interface this
was pretty simple but very useful now in
our demo we use the OneNote REST API
endpoint to perform operations on
notebooks you can also use a converge
endpoint at graph dot microsoft.com to
access OneNote notebooks Microsoft graph
is a single converged endpoint to access
information about users groups files
messages calendar contacts tasks and
notes all under the same roof now the
graph API for OneNote are currently in
preview and should be available next
year so what's next from one noting we
are currently working on Arab enabling
live one note pages embedded on a
website this allows you to embed OneNote
pages in your website users can then
take notes in OneNote right from within
your website that would be really cool
we are also working on OneNote add-ins
this will allow you to build add-ins for
OneNote and publish them on office store
lastly we are also working on tools to
showcase apps and also some more samples
now if you have some suggestions please
reach out to us on a one north's user
voice page and let us know what you need
now I'm sure by now you must be really
excited about all the opportunities with
OneNote api's for more information it
related to one or api's please go to dev
godwyn or calm and get all the
documentation core samples videos and
blogs please engage with us on Stack
Overflow or Twitter let us know what
cool apps that you're building and thank
you so much

No comments:

Post a Comment