OneNote
.
client ID
, this value uniquely identifies your application in the Microsoft identity platform.http://localhost:8000/callback
client_secret
) under Application Secrets section.SCOPES
(Notes.Read
) to your application.pip install msal
and pip install beautifulsoup4
.CLIENT_ID
CLIENT_SECRET
OneNoteLoader
expects that the values of CLIENT_ID
and CLIENT_SECRET
must be stored as environment variables named MS_GRAPH_CLIENT_ID
and MS_GRAPH_CLIENT_SECRET
respectively. You could pass those environment variables through a .env
file at the root of your application or using the following command in your script.
onenote_graph_token.txt
) at ~/.credentials/
folder. This token could be used later to authenticate without the copy/paste steps explained earlier. To use this token for authentication, you need to change the auth_with_token
parameter to True in the instantiation of the loader.
OneNoteLoader
can load pages from OneNote notebooks stored in OneDrive. You can specify any combination of notebook_name
, section_name
, page_title
to filter for pages under a specific notebook, under a specific section, or with a specific title respectively. For instance, you want to load all pages that are stored under a section called Recipes
within any of your notebooks OneDrive.
object_ids
for each page you want to load. For that, you will need to query the Microsoft Graph API to find all the documents ID that you are interested in. This link provides a list of endpoints that will be helpful to retrieve the documents ID.
For instance, to retrieve information about all pages that are stored in your notebooks, you need make a request to: https://graph.microsoft.com/v1.0/me/onenote/pages
. Once you have the list of IDs that you are interested in, then you can instantiate the loader with the following parameters.