使用 Ms graph 设置更改通知(订阅)服务后如何从 Azure 函数应用程序获取 visual studio 中的通知

After setting Change Notification(subscring) a service using Ms graph how to get the notification in visual studio from Azure function app

我可以通过在 C# 中使用此图形 api 请求在线订阅 meeting/calls 并将通知 url 设置为 azure 函数应用程序。它运行完美,我可以在 Azure 函数应用程序中看到通知。有什么方法可以使用 C# 程序或图形 api 请求从 azure 函数应用程序获取通知到 visual studio。

POST https://graph.microsoft.com/beta/subscriptions

内容类型:application/json

{
  "changeType": "created,updated",
  "notificationUrl": "https://notificationes.azurewebsites.net/api/HttpTrigger1?code=h61e/.............",
  "resource": "/communication/callrecords",
  "includeResourceData": true,
  "expirationDateTime": "2021-05-9T11:00:00.0000000Z",
  "clientState": "{secretClientState}"
}

由于您可以在您的功能日志中看到通知,因此您也可以根据功能的获取日志来获取通知。

您可以使用此 rest api 应用程序洞察力来获取函数的日志。在 visual studio 中的 c# 代码中对此 api 执行 post 请求,然后解析响应数据,您可以在日志中获取通知。

如果您不知道如何请求 api,您可以在 Azure 门户上转到您的功能并单击“监控”选项卡。

然后按“F12”打开浏览器开发者工具,点击“监视器”中的其中一条日志。可以在浏览器后台看到请求。

点击查询请求,您可以找到查询请求的详细信息,如下图所示。然后你就可以模仿它在你的代码中写出你的查询请求了。