我必须在C#中使用HTTP客户端进行补丁请求。查看Get请求非常简单:
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);
但是对于补丁,我找不到PatchAsync方法,似乎只有POST和PUT。
答案 0 :(得分:1)
在代码中将GetAsync替换为
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);