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

392 Views Asked by At

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?

1

There are 1 best solutions below

0
codeye On

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