How to access shared content using OneNote api

落花浮王杯 提交于 2021-01-27 13:44:12

问题


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.


回答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.




回答2:


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/



来源:https://stackoverflow.com/questions/44780317/how-to-access-shared-content-using-onenote-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!