Locke
Locke

Reputation: 325

No HTTP resource was found that matches the request

I tried to replace the Page content using Microsoft Graph like this:

MultipartFormDataContent form = new MultipartFormDataContent();
form.Add( some stream contents );
var formdatastream = form.ReadAsStreamAsync();
graphClient.Users[userPrincipalName]
  .Onenote
  .Pages[onenotepage.Id]
  .Content
  .Request()
  .PutAsync<OnenotePage>(formdatastream);

It returns No HTTP resource was found that matches the request, which implies that it does not accept an HTTP PUT request.

Clearly, it is saying it accepts HTTP Patch so maybe the .Net library needs to be changed?

Upvotes: 1

Views: 447

Answers (2)

Jorge Aguirre
Jorge Aguirre

Reputation: 2857

To update the OneNote API, you need to trigger a PATCH request like so:

PATCH https://graph.microsoft.com/v1.0/me/onenote/pages/{id}/content
{JSON PAYLOAD}

Perhaps that's not what the SDK is doing?

Upvotes: -1

Dmitry Pimenov
Dmitry Pimenov

Reputation: 739

This is a known issue and is a result of a mismatch of the service definition and the service behavior.

If you search for 'onenoteupdatepage' in the OneNote SDK tests, you can see one possible workaround for how to replace an existing page.

Upvotes: 2

Related Questions