Forum Discussion
OneNote copyToSection: Returning id for new page
When copying a OneNote page to another section using graph, one might need the page-id of the newly created page to perform other operations. In the documentation it states that we should expect a success status of 202 with an operation-location parameter in the header which I assume would be queried for more information. We are however getting a status 200, without an operation-location and none of the properties in the response seem to have the id or location of the page in the destination section.
Also, nothing in the response seems to be giving us a handle on the newly created page url or page id.
Is the documentation out dated, and how can we get the details of the newly created page in the response?
page: copyToSection - Microsoft Graph v1.0 | Microsoft Learn
Actual response:
{
"@odata.context": https://graph.microsoft.com/v1.0/$metadata#groups('d5f78031-63e4-460a-971c-b289d0624fa6')/onenote/pages/$entity,
"id": "1-fe18bac516b04b63a13164a45494b513!6-6fb566fe-454f-4de6-87f2-41d22a0e30da",
"self": https://graph.microsoft.com/v1.0/groups/d5f78031-63e4-460a-971c-b289d0624fa6/onenote/pages/1-fe18bac516b04b63a13164a45494b513!6-6fb566fe-454f-4de6-87f2-41d22a0e30da,
"createdDateTime": "2023-03-20T09:43:00Z",
"title": "Test DVH OneOne1",
"createdByAppId": "f25ba475-51f9-45c8-bab8-e05d84eccbb5",
"contentUrl": https://graph.microsoft.com/v1.0/groups/d5f78031-63e4-460a-971c-b289d0624fa6/onenote/pages/1-fe18bac516b04b63a13164a45494b513!6-6fb566fe-454f-4de6-87f2-41d22a0e30da/content,
"lastModifiedDateTime": "2023-03-20T09:52:00Z",
"links": {
"oneNoteClientUrl": {
"href": onenote:”obviscated”
},
"oneNoteWebUrl": {
"href": “obviscated”
}
},
parentSection@odata.context: https://graph.microsoft.com/v1.0/$metadata#groups('d5f78031-63e4-460a-971c-b289d0624fa6')/onenote/pages('1-fe18bac516b04b63a13164a45494b513%216-6fb566fe-454f-4de6-87f2-41d22a0e30da')/parentSection/$entity,
"parentSection": {
"id": "1-6fb566fe-454f-4de6-87f2-41d22a0e30dd",
"displayName": "New Section",
"self": https://graph.microsoft.com/v1.0/groups/d5f78031-63e4-460a-971c-b289d0624fa6/onenote/sections/1-6fb566fe-454f-4de6-87f2-41d22a0e30da
}
}