【发布时间】:2020-11-01 14:56:35
【问题描述】:
我正在尝试与学生共享一个笔记课堂笔记本,但遇到了权限问题。我已经添加了 Azure APP 中所需的所有权限。我正在获取访问令牌,刷新令牌,其范围为Notes.ReadWrite.All
方法:-
public static async Task<string> AssignNotebookToStudent(string studentEmail, string fileId)
{
var payload = new
{
id = studentEmail,
principalType = "Person"
};
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Add("Authorization", $"Bearer {tokenValue}");
client.DefaultRequestHeaders.Add("accept", "application/json");
var result = await client.PostAsJsonAsync($"https://www.onenote.com/api/v1.0/me/notes/classNotebooks/{fileId}/students", payload);
var responseString = await result.Content.ReadAsStringAsync();
return responseString;
}
获取权限响应错误
【问题讨论】:
标签: c# asp.net-mvc microsoft-graph-api onenote-api