如何使用Onenote Graph API删除和重命名笔记本名称 [英] How to Delete and Rename Notebook name Using Onenote Graph API

查看:138
本文介绍了如何使用Onenote Graph API删除和重命名笔记本名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想重命名笔记本名称.我尝试了以下图请求.

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

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

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

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

推荐答案

OneNote笔记本是暴露于OneDrive api的文件夹,可以是

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

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

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

示例php代码以删除笔记本(您将通过

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.

示例php代码重命名笔记本

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;

这篇关于如何使用Onenote Graph API删除和重命名笔记本名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆