question

JehanzebMobarik-9269 avatar image
0 Votes"
JehanzebMobarik-9269 asked Paul-6113 answered

Use OneNote API to get notebooks shared with me

Hello,

I'm hoping someone could advise/help on a question I have regarding the OneNote API.

I, along with my colleagues, have a shared OneNote notebook that we use to store information about procedures. I came across the Microsoft Graph API which would allow me to edit a OneNote page from a script that I am looking to develop.

However, when I tested out the Graph Explorer, I found that it was only listing the Notebooks that I explicitly own rather than the Notebooks that I own as part of a team or Notebooks that are shared with me.

Could someone please explain what I need to do in order to get the Notebooks and their pages that are shared with me.

Regards,
Jehanzeb Mobarik

microsoft-graph-applicationsmicrosoft-graph-notes
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Sheena-MSFT avatar image
0 Votes"
Sheena-MSFT answered JehanzebMobarik-9269 commented

Hi @JehanzebMobarik-9269,

Currently this is not supported using OneNote API. This feature fix is in Microsoft product backlog list and they are planning to implement it in future based on the priority order set by them.

As a work around use drive_sharedwithme

Related Post : https://docs.microsoft.com/en-us/answers/questions/763468/index.html

If the answer is helpful, please click Accept Answer and kindly upvote it. If you have any further questions about this answer, please click Comment.

[2]: https://docs.microsoft.com/en-us/answers/questions/763468/index.html




· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi Sheena-MSFT,

Thanks for replying to the question.

By using the drive_sharedwithme workaround, will allow it allow me to firstly get the ID back of the Notebook and then go onto request the pages within that notebook?

I actually just tried out the drive_sharedwithme and I can see the OneNote notebook that has been shared with me and it has an ID attached to it. So from there, how do I go onto request the pages from the notebook?

I have attached an image to show the result from the drive_sharedwithme api call

194851-image.png


0 Votes 0 ·
image.png (34.2 KiB)
JehanzebMobarik-9269 avatar image
0 Votes"
JehanzebMobarik-9269 answered JehanzebMobarik-9269 commented

Hi Sheena-MSFT,

Do you have an update on the above comment?

Regards,
Jehanzeb Mobarik

· 4
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi JehanzebMobarik-9269,

As per my testing, using drive_sharedwithme it is not possible to get the one note pages.

0 Votes 0 ·

Ok thanks for confirming. I thought that this was the case.

I think it is important for Microsoft to update its OneNote API documentation to show that certain features of the API do not work.

For example in this case, the API documentation says that it is possible to retrieve pages of shared OneNote notebooks, however, this is false given what we have just discussed.

If the documentation is unclear it misleads the users of the Graph AP's

0 Votes 0 ·
Sheena-MSFT avatar image Sheena-MSFT JehanzebMobarik-9269 ·

Hi @JehanzebMobarik-9269,

After further research on this I have the following update for you.

This endpoint https://graph.microsoft.com/v1.0/me/onenote/notebooks is used to access OneNote content for the current-user (owned and shared(the one which current user shared)).

For getting the notebooks shared to you by a specific user (within your tenant), you can pass that user's userId in this endpoint https://graph.microsoft.com/v1.0/users/{user-id}/onenote/notebooks. This will return the OneNote content that the specified user (in the URL) has shared with you(current-user).

0 Votes 0 ·
Show more comments
Paul-6113 avatar image
0 Votes"
Paul-6113 answered

Hi @JehanzebMobarik-9269,


i was able to use the graph api to connect to a shared onenote. You have to modify the url a little: https://graph.microsoft.com/v1.0/groups/{group-id}/onenote/notebooks

All you need to know is the group id of the shared notebook. In my case i had a onenote shared via sharepoint and teams. I was able to find the spezific group in azure ad and look up the group id. Modifying the standard url of the graph api a little and switching out "users" for "groups" i was able to connect. I used an app registration in azure and a logiy app via http request to make my get request. I am sure you can use it for a post too.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.