I am trying to add a page to a Onenote notebook using C#, and the code below. I can create notebooks and sections in notebooks, so I think the client and scopes are valid, but the last line throws an exception: "Microsoft.Graph.Models.ODataErrors.ODataError.' Any help would be appreciated.
private async void createOnenotePage(string sectionId, string htmlString)
{
var graphClient = GraphHelper._userClient;
var onenotePage = new OnenotePage();
// Convert the HTML string to a byte array
byte[] contentBytes = Encoding.UTF8.GetBytes(htmlString);
onenotePage.Content = contentBytes;
var response = await graphClient.Me.Onenote.Sections[sectionId].Pages.PostAsync(onenotePage);
}
In case anyone has the same question, the C# SDK does not appear to support this. This works: