Please provide the following (and please check them off the list with [x]) before submitting this issue:
[x] Expected behavior. Please provide links to the specific Microsoft Graph documentation you used to determine the expected behavior.
[x] Actual behavior. Provide error codes, stack information, and a Fiddler capture of the request and response (please remove personally identifiable information before posting).
[x] Steps to reproduce the behavior. Include your code, IDE versions, client library versions, and any other information that might be helpful to understand your scenario.
Expected behavior
I'm using this code to create a OneNote page and get its preview afterwards:
string htmlBody = $"< !DOCTYPE html >< html > < head >< title > </ title ></head> <body></body></html> ";
byte[] byteArray = Encoding.ASCII.GetBytes(htmlBody);
using (MemoryStream stream = new MemoryStream(byteArray))
{
// Create a OneNote page.
var emptyPage = new OnenotePage() { Title = "New page", Content = stream };
page = await client.Me.Onenote.Sections[sectionId].Pages.Request().AddAsync(stream, "text/html");
}
// await Task.Delay(1000);
var preview = await client.Me.Onenote.Pages[x.Id].Preview().Request().GetAsync();
Which should work as expected.
Actual behavior
When running the code I get the following exception:
Microsoft.Graph.ServiceException: 'Code: 20102
Message: The specified resource ID does not exist.
After playing with it I found that if I add the commented Task.Delay the exception doesn't happen anymore, so my guess is that the second request is happening before the notebook is actually created, and by introducing the delay I'm avoiding the race condition. Since I'm already awaiting the AddAsync method, I would expect the page to be created before the second request happens.
Please provide the following (and please check them off the list with [x]) before submitting this issue:
Expected behavior
I'm using this code to create a OneNote page and get its preview afterwards:
Which should work as expected.
Actual behavior
When running the code I get the following exception:
After playing with it I found that if I add the commented Task.Delay the exception doesn't happen anymore, so my guess is that the second request is happening before the notebook is actually created, and by introducing the delay I'm avoiding the race condition. Since I'm already awaiting the AddAsync method, I would expect the page to be created before the second request happens.
Steps to reproduce the behavior
I'm using version 1.12.0 of the sdk
AB#7316