如何使用 Onenote Graph 删除和重命名笔记本名称 API

How to Delete and Rename Notebook name Using Onenote Graph API

我想重命名笔记本名称。我尝试了下面的图形请求。

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

我收到 "UnknownError",什么是重命名笔记本的 PATCH 请求 url?

这是不支持的。您可能想将此添加到我们的用户语音中。

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

OneNote 笔记本在暴露于 OneDrive api 时是文件夹,并且可以是 renamed or deleted

但是,OneDrive 文档特别建议不要对 OneNote 笔记本执行此操作。

示例 php 删除笔记本的代码(您将通过 https://graph.microsoft.com/v1.0/me/drive/root/children 获得 {item-id})

$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;

删除的笔记本被移动到回收站。

重命名 NoteBook 的示例 php 代码

$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;