How to Delete and Rename Notebook name Using Oneno

2019-08-23 03:51发布

I want to rename notebook name. i tried below Graph request.

PATCH "graph.microsoft.com/v1.0/me/onenote/notebooks{id}" 

I am getting "UnknownError", What is PATCH Request url to rename notebook?

2条回答
smile是对你的礼貌
2楼-- · 2019-08-23 04:19

OneNote Notebooks are folders when exposed to the OneDrive api and can be renamed or deleted.

The OneDrive documentation, however, specifically suggests not doing this with OneNote Notebooks.

sample php code to delete NoteBook (you would obtain {item-id} via https://graph.microsoft.com/v1.0/me/drive/root/children)

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,
    'https://graph.microsoft.com/v1.0/me/drive/items/{item-id}');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST => 'DELETE');
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLINFO_HEADER_OUT, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: */*',
    'return-client-request-id: true','Content-Type: application/json',
    'Authorization: Bearer eyJ0eXAiOiJKV1Qi…));
$response = curl_exec($ch);
curl_close($ch);
return $response;

The deleted Notebook is moved to the Recycle bin.

sample php code to rename NoteBook

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,
    'https://graph.microsoft.com/v1.0/me/drive/items/{item-id}');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST => 'PATCH');
curl_setopt($ch, CURLOPT_POSTFIELDS,'{"name":"newname"}');  
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLINFO_HEADER_OUT, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: */*',
    'return-client-request-id: true','Content-Type: application/json',
    'Authorization: Bearer eyJ0eXAiOiJKV1Qi…));
$response = curl_exec($ch);
curl_close($ch);
return $response;
查看更多
再贱就再见
3楼-- · 2019-08-23 04:20

This is not supported. You might want to add this to our uservoice.

https://onenote.uservoice.com/forums/245490-onenote-developer-apis

查看更多
登录 后发表回答