0

I want to create OneNote file using MS Graph API. functionality should be same as creating OneNote file in Teams channel
as in below Image, I created OneNote file from Documents> Genaral>Folder One location.
But I couldn't do same thing from graph api

enter image description here

I tried this https://graph.microsoft.com/v1.0/sites/{SITE_ID}/onenote/notebooks graph api .
but it doesn't have way to indicate folder name and also it creates OneNote file under folder called 'Notebooks'

is thee way to accomplish this using graph api ?

DevÁsith
  • 1,072
  • 12
  • 38

1 Answers1

0

I'm assuming your deriving the API call from the Create notebook page
You can then use OneDrive/Sharepoint end points to move the Notebook from the Notebooks folder to the Documents> Genaral>Folder One location.
As described on Get a DriveItem resource page get the "driveId" ("sited" also appears to work) and "id" of the notebook and the "id" of the destination folder using a call such as
GET /sites/{siteId}/drive/root:/{item-path}
Move a DriveItem to a new folder end point to complete the process

PATCH /drives/{driveid}/items/{id}
Content-type: application/json

{
  "parentReference": {
    "id": "{destination-folder-id}"
  },
  "name": "Notebook1"
}
codeye
  • 607
  • 3
  • 10