Microsoft Graph Webhook/Subscription, getting multiple post to my notificationUrl

后端 未结 1 515
半阙折子戏
半阙折子戏 2021-02-09 13:35

Im trying to receive push notification on calendar events through microsoft graph

the notificationURL points to webservice which is running on NodeJS

subscripti

1条回答
  •  孤城傲影
    2021-02-09 14:37

    I have this same issue. When creating new event in office calendar I'll get everytime one notification with ChangeType: Created and at the same time three notifications with ChangeType: Updated. When I'm cancelling event in office I get always 3 x Updated notifications and finally 1 x ChangeType: Deleted.

    What you can do here is to use ChangeKey validation. Everytime you get new notification from office you have to request that event from API, right?

    Once you fetched that event you can check if event.ChangeKey property has changed.

    It's same thing as etag in websites. If content changes, etag hash changes.

    So when you get Created notification, take that event's ChangeKey and store it to array or db and whenever you get notification remember to validate if you have that event's ID already in array or db and also if ChangeKey has changed. If ChangeKey is same as last time, you won't need to update that event in db.

    This also works with recurring events, if even one occurrence has changed SeriesMaster event's ChangeKey also changes.

    0 讨论(0)
提交回复
热议问题