Im trying to build a python app/script that goes through a onenote notebook and create folders for each section and creates html files for each of the pages in the section that will be saved in the respective folder.
I tried to play around with the python msgraph-sdk but i cant figure out how to get actual notebook data like the one in the json responses in the graph explorer website
im copying some code snippets directly from graph explorer as well and all im getting is 400 bad request errors
credentials = ClientSecretCredential(tenant_id=tenant_id, client_id=client_id, client_secret=secret_id)
scopes = ["https://graph.microsoft.com/.default"]
client = GraphServiceClient(credentials=credentials, scopes=scopes)
async def main():
apps = await client.applications.get()
if apps and apps.value:
for app in apps.value:
print(app.display_name)
# Gets registered app name as expected
await client.me.onenote.pages.by_onenote_page_id(
"0-e4480296df44483797a6e9498a27ee08!240-2D4AD3C4F6B959E4!363379",
).content.get()
# 400 Bad request
# msgraph.generated.models.o_data_errors.o_data_error.ODataError:
# APIError
# Code: 400
# message: None
asyncio.run(main())
Ive registered the following permissions in my azure app registration :
Notes.Read.All
Application.Read.All
User.Read