Create OneNote notebook in document library (other than OneDrive) using graph api - microsoft-graph-api

I have created another document library in my personal sharepoint site. When I run the
GET /me/drives/
It shows both OneDrive and my created document library. Since I can create OneNote Notebook in the another document library from the UI, I want to achieve the same thing using graph api. However, currently supported graph api to create notebook are
POST /me/onenote/notebooks
POST /users/{id | userPrincipalName}/onenote/notebooks
POST /groups/{id}/onenote/notebooks
POST /sites/{id}/onenote/notebooks
When I execute any one of these api, it always creates Notebook in the OneDrive. Is there any way to create Notebook in the specific document library?

This should work in Onenote-API
POST https://www.onenote.com/api/beta/myOrganization/siteCollections/{id}/sites/{id}/notes/notebooks
or Graph-API
POST https://graph.microsoft.com/beta/sites/westerneye.sharepoint.com,{sitecollectionid},{siteid}/onenote/notebooks

Related

Is it possible to give read permissions to users in sharepoint using Microsoft Graph

I'm using Microsoft Graph API to upload large files to sharepoint using createUploadSession endpoint.
Is there a way to give read permissions in upload process to a specific user or I have to use other endpoint for this?
Yes it is possible to manage and change permissions of SharePoint online using Microsoft Graph API EndPoints: link
Permissions are managed separately through MS Graph End Points designated for permissions: link
Another stackover article on the same with slight different issue: link

How to know which file I have shared in Microsoft graph

I am working on a project where users can share files with clients.
I am using Microsoft graph api for the project and using the below to share the files.
POST https://graph.microsoft.com/v1.0/me/drives/{drive-id}/items/{item-id}/invite
I know you you have the api sharedWithMe but this is not what I want.
I want to know if it is possible to know which files they have shared.
e.g like a sharedByMe api
GET https://graph.microsoft.com/v1.0/me/drive/sharedByMe

Get role inheritance state for document library in SharePoint Online

I work with SharePoint Online drives(document libraries) with Microsoft Graph API (/drives call). With this API I can download/upload files but cannot work with permissions.
That's not a problem - I can do it with SharePoint Online REST API (with calls _api/web/GetListByTitle('Title')/hasuniqueroleassignments).
The main problem here is matching drive from MS Graph API and a corresponding list from SharePoint REST API. For now I match by title but I have several examples, when name field in MS Graph API is equal to "OneDrive", but title in List entity is Shared Pictures.
My question is: is there any way to match more precisely entities from Graph API and SharePoint REST API?
Thank you.
The Drive Item object has a SharePointIds property that will provide the information necessary to call the SharePoint REST API.
https://learn.microsoft.com/en-us/graph/api/resources/sharepointids?view=graph-rest-1.0
Use List resource, you could get list id.
Then use id to call rest api.
/_api/web/Lists(guid'54ca94c0-364e-4201-8fe7-a4c804769009')/hasuniqueroleassignments

Can you use OneDrive Graph API to Download files in bulk?

I am a Java application developer that wants to use Microsoft Graph API to download onedrive files.
Is there a OneDrive Graph API method that can download multiple files in bulk? Or are you forced to use a file-by-file download approach?
I've googled for a while now to see if I can find some answer to this. I did find: https://onedrive.uservoice.com/forums/262982-onedrive/suggestions/9255150-multiple-file-download-onedrive-for-business
Which states that you can actually use OneDrive web UI to download files in bulk.
But does it exist for API?

Access to a shared notebook using microsoft graph's API

I found it no way to find the notebook's id shared in my team using Microsoft Graph API. How can I update content in a shared location in out team..?
GET https://graph.microsoft.com/v1.0/me/onenote/notebooks
This only gives back the notebook created by me.
There are a couple of workaround ways you can do this:
Access the notebook via the individual who owns it:
https://graph.microsoft.com/v1.0/users/uid/onenote/notebooks
Access the notebooks shared with your group:
https://graph.microsoft.com/v1.0/groups/gid/onenote/notebooks

Resources