3

I am integrating OneNote in my application. Using the OneNote API I am able to fetch all the Notebooks that belong to a particular user.

Let's say a user A has 5 Notebooks of his own and 2 shared Notebooks.

Let's say NoteBook6 is shared by user which is part of organization same A and NoteBook7 is shared by external user.

In my application I want to access all these 7 notebooks which user can access. I tried this using Microsoft Graph as well as the OneNote API but I am only able to access the 5 notebooks owned by the user.

Is there any way to access Notebook6 and Notebook7 using any API, provided I am unaware of who has shared the content with my user?

Microsoft Graph provides:

https://graph.microsoft.com/v1.0/users/{id}/onenote/notebooks 

I don't want to use these endpoints to access shared content as this requires details about user who has shared notebooks with me.

Marc LaFleur
  • 31,987
  • 4
  • 37
  • 63
Pooja Dhannawat
  • 263
  • 2
  • 8

2 Answers2

1

I'm afraid not, this endpoint will only return notebooks owned by the current user.

If the notebook was explicitly shared with the current user, it will show up via the OneDrive API using https://graph.microsoft.com/v1.0/me/drive/sharedWithMe. This wouldn't return notebooks that the user organically has access to (i.e. part of a group or sharepoint site they happen to have access to) so this may not be sufficient. That said, assuming you have the proper permission scopes, you may be able to construct a valid URI to open that notebook (please note that this is partially conjecture on my part, I've not had the chance to try this yet).

Conceptually, having a onenote/notebooks/sharedWithMe method makes sense. I can see several scenarios where this would be quite valuable. I would strongly suggest adding this suggestion to the UserVoice site so it can be considered for future revisions.

Marc LaFleur
  • 31,987
  • 4
  • 37
  • 63
  • 1
    Added this to UserVoice site. – Pooja Dhannawat Jun 28 '17 at 05:44
  • I am using this api to retrieve the list of notebooks shared with me. https://graph.microsoft.com/v1.0/me/onenote/notebooks?includesharednotebooks=true The problem here is when I get list of shared notebooks in the field createdBy the dislplayName is reflecting the valid name of user who has shared this with me. But in that the id of user reflected is incorrect. It's just displaying my id in that. This seems to be like bug in onenote api – Pooja Dhannawat Sep 26 '17 at 12:09
  • I would double check that. I can't replicate this behavior. I attempted to reproduce by creating 2 users, each with 2 notebooks. Each had 1 notebook shared with the other. Hitting `/me/onenote/notebooks` only returns 2 notebooks for each of the users. You're suggesting you would see 3? – Marc LaFleur Sep 26 '17 at 14:41
  • Yes I would see three notebooks of if I am adding includesharednotebooks=true as request parameter. But after that I can't access the sections/pages in that shared notebooks – Pooja Dhannawat Sep 26 '17 at 17:01
0

Try calling the following API:

https://www.onenote.com/api/v1.0/me/notes/notebooks/getrecentnotebooks(includePersonalNotebooks=true)

https://blogs.msdn.microsoft.com/onenotedev/2017/04/21/get-recent-notebooks-api/

Jorge Aguirre
  • 2,787
  • 3
  • 20
  • 27
  • This is just giving me notebooks name. How can I access the section or pages inside these notebooks – Pooja Dhannawat Jun 28 '17 at 06:45
  • 1
    I am using this api to retrieve the list of notebooks shared with me. https://graph.microsoft.com/v1.0/me/onenote/notebooks?includesharednotebooks=true The problem here is when I get list of shared notebooks in the field createdBy the dislplayName is reflecting the valid name of user who has shared this with me. But in that the id of user reflected is incorrect. It's just displaying my id in that. This seems to be like bug in onenote api – Pooja Dhannawat Sep 26 '17 at 08:59