Trying to update a OneNote page using Graph API for a json request for Python

84 Views Asked by At

How can you add content to the end of a OneNote page?

access_token = token["accessToken"] # This token is verified and working
end_point = "https://graph.microsoft.com/v1.0/users/{my_user_id}/onenote/notebooks/pages/{my_page_id}/content"
 headers = { "Authorization": "Bearer " + token["accessToken"] , "Content-Type": "application/json"}

data = {'target': {paragraph_id},
         'action': 'append', 
         'content': '<li>' + title + '\n\n' + description + '</li>'}

response = requests.patch(config['urlDrNotesON2'], headers=headers, json=data)

I suspect the issue might be related to the the user id {my_user_id}. I've tried different ones (Application (client) ID, Directory (tenant) ID, secret ID)), but without success.

0

There are 0 best solutions below