即使创建了订阅,我也没有收到 Graph API 通知。
我添加了一个订阅来观察用户邮箱的变化。Graph API 正确验证了 Webhook 端点,并正确创建了令牌和订阅。
var user = await _graphclient
.Users[userEmailAccount]
.Request()
.GetAsync();
var subscription = await _graphclient.Subscriptions
.Request()
.AddAsync(new Subscription()
{
NotificationUrl = $"https://1f81513d3.ngrok.io/api/mailbox/notification",
ChangeType = "created",
ExpirationDateTime = DateTime.UtcNow + new TimeSpan(0, 0, 15, 0),
Resource = $"users/{user.Id}/mailfolders('inbox')/messages",
});
我还可以通过调用/Subscriptions
.
[
{
"resource": "users/csaqwasce-q4c-4a8d-9cb9-e8ca5edcfe3b/mailfolders('inbox')/messages",
"changeType": "created",
"notificationUrl": "https://1f81513d3.ngrok.io/api/mailbox/notification",
"expirationDateTime": "2019-06-01T10:20:27.215458+00:00",
"applicationId": "2d932e57-3403-48ae-81ad-dea32fb1fb4d",
"creatorId": "e4572948-bc6c-4bb6-bca3-51336466e567",
"id": "a822332e-d605-44b7-92d8-49e2b3dc113e",
"clientState": null
}
]
我已向该帐户发送了一封电子邮件,但即使看起来端点设置正确,我也从未收到通知。我试图将 Resource 更改为users/messages
, different ChangeType
or ExpirationDateTime
,但没有成功。
我不知道如何解决这个问题。