Microsoft graph api ChangeNotification类中未定义活动(问题已由MS支持部门确认)
我正在使用以下测试应用程序检索状态: 在下面的函数中,它接收webhooks回调。它最初执行以下代码来检索纯文本通知:Microsoft graph api ChangeNotification类中未定义活动(问题已由MS支持部门确认),microsoft-graph-api,webhooks,microsoft-graph-mail,Microsoft Graph Api,Webhooks,Microsoft Graph Mail,我正在使用以下测试应用程序检索状态: 在下面的函数中,它接收webhooks回调。它最初执行以下代码来检索纯文本通知: // The notificationUrl endpoint that's registered with the webhook subscription. [HttpPost] [AuthorizeForScopes(ScopeKeySection = "SubscriptionSettings:Scope")] public async Task&
// The notificationUrl endpoint that's registered with the webhook subscription.
[HttpPost]
[AuthorizeForScopes(ScopeKeySection = "SubscriptionSettings:Scope")]
public async Task<IActionResult> Listen([FromQuery]string validationToken = null)
{
if (string.IsNullOrEmpty(validationToken))
{
try
{
// Parse the received notifications.
var plainNotifications = new Dictionary<string, ChangeNotification>();
var options = new JsonSerializerOptions
{
PropertyNameCaseInsensitive = true
};
options.Converters.Add(new JsonStringEnumConverter(JsonNamingPolicy.CamelCase));
var collection = await JsonSerializer.DeserializeAsync<ChangeNotificationCollection>(Request.Body, options);
foreach (var notification in collection.Value.Where(x => x.EncryptedContent == null))
{
SubscriptionStore subscription = subscriptionStore.GetSubscriptionInfo(notification.SubscriptionId.Value);
// Verify the current client state matches the one that was sent.
if (notification.ClientState == subscription.ClientState)
{
// Just keep the latest notification for each resource. No point pulling data more than once.
plainNotifications[notification.Resource] = notification;
}
}
if (plainNotifications.Count > 0)
{
// Query for the changed messages.
await GetChangedMessagesAsync(plainNotifications.Values);
}
是否有计划将活动和可用性添加到ChangeNotification类中,或者我是否应该坚持解决方案
谢谢
埃德·詹姆斯
string l_szReqBody = await new StreamReader(Request.Body).ReadToEndAsync();
string l_szDisplay = "";
dynamic data = JsonConvert.DeserializeObject(l_szReqBody);
// Verify if the request body is not empty and has json data
if (!string.IsNullOrEmpty(l_szReqBody))
{
JObject body = JObject.Parse(l_szReqBody);
if (body.ContainsKey("value"))
{
//JValue resource = (JValue)body["value"][0]["resource"];
l_szDisplay = string.Concat("WEB HOOK:" + "ID=" + body["value"][0]["resourceData"]["id"] +
", Activity=" + body["value"][0]["resourceData"]["activity"] +
", Availability=" + body["value"][0]["resourceData"]["availability"]);
}
}