[英]MS Graph API filter on forceChangePasswordNextSignIn
[英]MS Graph API - getPstnCalls from C#
我无法弄清楚如何从 C# 中的 MS Graph 调用 getPstnCalls。我目前使用的是最新版本的 Graph Microsoft Graph 4.51.0
。 根据文档,调用 getPstnCalls 的方式和调用 get callRecord 的方式与 C# 相同。
var callRecord = await graphClient.Communications.CallRecords["{callRecords.callRecord-id}"]
.Request().GetAsync();
看起来有几个人要求更新文档; 有些可以追溯到 2020 年,当时 getPstnCalls 仍处于测试阶段。
我期待它是这样的:
var pstnCallLogRows = await graphClient.Communications.CallRecords.GetPstnCalls
.Request().GetAsync();
请注意,基于我期望与文档完全不同的数据类型。 ( List<pstnCallLogRow>
而不是callRecord
)
有谁知道如何从 C# 拨打这个电话?
SDK 4.51 不支持getPstnCalls
但有一个 model PstnCallLogRow
用于pstnCallLogRow
资源类型。
您至少可以尝试创建一个 http 请求并反序列化响应 object。
var requestUrl = client
.Communications
.CallRecords
.AppendSegmentToRequestUrl("getPstnCalls(fromDateTime=2023-01-18T06:00:00Z,toDateTime=2023-01-24T07:00:00Z)");
// create GET request message
var hrm = new HttpRequestMessage(HttpMethod.Get, requestUrl);
// authenticate request message
await client.AuthenticationProvider.AuthenticateRequestAsync(hrm);
// send the request
var response = await client.HttpProvider.SendAsync(hrm);
if (response.IsSuccessStatusCode)
{
// read response json string - it should be a collection of pstnCallLogRow
var responseString = await response.Content.ReadAsStringAsync();
// deserialize to a collection of PstnCallLogRow
var logRows = client.HttpProvider.Serializer.DeserializeObject<List<PstnCallLogRow>>(responseString);
}
else
{
throw new ServiceException(
new Error
{
Code = response.StatusCode.ToString(),
Message = await response.Content.ReadAsStringAsync()
});
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.