Javier171296
Javier171296

Reputation: 49

How to set OneNote API´s permissions

I Need to use OneNote API in order to get pages by searching specific words in their content with search attribute.

I have made a successful connection to Microsoft Graph, but it doesn´t have support to search words in pages´s content.

In order to get the access token I am using https://login.microsoftonline.com as endpoint url.

As I said I already did a successful connection to Microsoft Graph with the following request : https://login.microsoftonline.com/common/oauth2/v2.0/authorize?scope=Notes.ReadWrite.All+openid+email+profile+offline_access&client_id=4e3c319

with that I got the accesstoken and I was able to get pages using https://graph.microsoft.com/v1.0/me/onenote/pages, but I need to get pages by searching words in their content, so I am trying with onenote api that has search attribute.

If I try with https://www.onenote.com/api/v1.0/me/notes/pages I get Unauthorized error.

I have added onenote api´s scopes : office.onenote_update, office.onenote, etchttps://login.microsoftonline.com/common/oauth2/v2.0/authorize?scope=office.onenote_update+openid+email+profile

But : I got this issue

How can I set the correct scopes for onenote api but using https://login.microsoftonline.com as I did with Microsoft Graph because I need to use that oauth endpoint

Upvotes: 0

Views: 346

Answers (2)

Amol Natu
Amol Natu

Reputation: 151

I addition to Jorge's answer above, get pages by searching words in their content is not supported for O365 Users.

In summary - (Get Pages with certain text in the content)

O365 account - Not supported, you will receive 503.

Microsoft account - Supported.

Upvotes: 1

Jorge Aguirre
Jorge Aguirre

Reputation: 2857

https://github.com/microsoftgraph/microsoft-graph-docs/blob/master/api-reference/beta/api/page_get.md

You're using the SCOPES for OneNote API - Graph API has a different set of scopes.

You should use something like Notes.ReadWrite.All.

Upvotes: 1

Related Questions