我正在尝试向团队频道发布聊天消息,但是图形API失败,状态代码为500,错误消息为“无法找到目标地址”。
var httpRequestMessage = new HttpRequestMessage();
httpRequestMessage.Headers.Authorization = new AuthenticationHeaderValue("Bearer", accessToken);
httpRequestMessage.RequestUri = new Uri($"https://graph.microsoft.com/v1.0/teams/{teamId}/channels/{channelId}/messages");
httpRequestMessage.Method = HttpMethod.Post;
httpRequestMessage.Content = new StringContent(JsonConvert.SerializeObject(new Message()
{
Body = new ItemBody()
{
ContentType = BodyType.Text,
Content = message
}
}), Encoding.UTF8, "application/json");
var task = Task.Run(() => Client.SendAsync(httpRequestMessage));