I can use the code below to create a page in a section and I can create a Notebook in the OneNote OneDrive using the APIGee console app, but I cannot figure out how to create a new Notebook in the OneNote client program. Below is a snippet of my code to create a page in the Foo section.
How can I modify this code to create a new Notebook in the client?
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);