C# OneNoteAPI不创建页面

C# OneNoteAPI不创建页面,c#,onenote-api,C#,Onenote Api,我使用了一些代码来实现OneNote API页面上的OneNote API 以下是迄今为止我在Word加载项类中的代码: private void ThisAddIn_Startup(object sender, System.EventArgs e) { CreatePage(); } public async void CreatePage() { var baseAddress = new Uri("https://www.onenote.com/api/");

我使用了一些代码来实现OneNote API页面上的OneNote API

以下是迄今为止我在Word加载项类中的代码:

private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
    CreatePage();
}


public async void CreatePage()
{
    var baseAddress = new Uri("https://www.onenote.com/api/");

    using (var httpClient = new HttpClient { BaseAddress = baseAddress })
    {
        httpClient.DefaultRequestHeaders.TryAddWithoutValidation("authorization", "Bearer tokenString");
        string sampleHtml = @"<html> <head> <title> Page with some info on it</title></head></html>";
        using (var content = new StringContent(sampleHtml, Encoding.Default, "applicaiton/xhtml+xml"))
        {
            using (var response = await httpClient.PostAsync("apis/onenote/reference/post-pages/v10menotessectionsidpages/undefined", content))
            {
                string responseData = await response.Content.ReadAsStringAsync();
            }
        }
    }
} 
private void ThisAddIn\u启动(对象发送方,System.EventArgs e)
{
CreatePage();
}
公共异步void CreatePage()
{
var baseAddress=新Uri(“https://www.onenote.com/api/");
使用(var httpClient=newhttpclient{BaseAddress=BaseAddress})
{
httpClient.DefaultRequestHeaders.TryAddWithoutValidation(“授权”、“承载令牌字符串”);
字符串sampleHtml=@“包含一些信息的页面”;
使用(var content=newstringcontent(sampleHtml,Encoding.Default,“application/xhtml+xml”))
{
使用(var response=wait httpClient.PostAsync(“API/onenote/reference/post pages/V10MenotessSectionSidPages/undefined”,内容))
{
string responseData=await response.Content.ReadAsStringAsync();
}
}
}
} 

该应用程序运行良好,没有生成错误/bug,但无法创建我一直在寻找的OneNote页面。我一直无法从onenote api创建页面。

端点uri看起来不正确。它应该是{sectionId}/pages上的帖子

此外,您的内容类型也有输入错误