1

I have to do a patch request using the HTTP Client in C#.Seems very simple to do a Get request:

        var httpclient = GetHttpClient(accessToken.Result);
        var response = await 
        httpclient.GetAsync("https://graph.microsoft.com/v1.0/me/messages");
        response.EnsureSuccessStatusCode();
        var content = await response.Content.ReadAsStringAsync();
        JObject o = JObject.Parse(content);

However for a patch, I cannot find a PatchAsync method, only seems to have POST and PUT.

user8608110
  • 211
  • 1
  • 4
  • 16

1 Answers1

1

Replace GetAsync with this in your code

var httpclient = GetHttpClient(accessToken.Result);
var response = await client.SendAsync(new HttpRequestMessage(new HttpMethod("PATCH"), "https://graph.microsoft.com/v1.0/me/messages"));
response.EnsureSuccessStatusCode();
var content = await response.Content.ReadAsStringAsync();
JObject o = JObject.Parse(content);
Mihir Dave
  • 3,954
  • 1
  • 12
  • 28