我可以使用下面的代码在一个部分中创建一个页面,我可以使用 APIGee 控制台应用程序在 OneNote OneDrive 中创建一个笔记本,但我不知道如何在 OneNote 客户端程序中创建一个新的笔记本。下面是我在 Foo 部分中创建页面的代码片段。
如何修改此代码以在客户端中创建新笔记本?
private static readonly Uri PagesEndPoint = new Uri("https://www.onenote.com/api/v1.0/pages?sectionName=Foo");
HttpResponseMessage response;
using (var imageContent = new StreamContent(await GetBinaryStream("assets\\SOAP.jpg")))
{
imageContent.Headers.ContentType = new MediaTypeHeaderValue("image/jpeg");
HttpRequestMessage createMessage = new HttpRequestMessage(HttpMethod.Post, PagesEndPoint)
{
Content = new MultipartFormDataContent
{
{new StringContent(simpleHtml, System.Text.Encoding.UTF8, "text/html"), "Presentation"},{imageContent, imagePartName}
}
};
// Must send the request within the using block, or the image stream will have been disposed.
response = await client.SendAsync(createMessage);
}
tbResponse.Text = response.ToString();
return await TranslateResponse(response);