I'm using the Microsoft Graph API to subscribe to notifications for calendar events through Node. Upon reading the documentation for best practices for Reduce missing subscriptions and notifications for Outlook resources (preview), it says that:
Certain events in Outlook can cause a subscription to be removed. These events include:
- User's password has been reset
- User's device is out of compliance
- User's account has been revoked
When such an event happens, Outlook sends a special lifecycle notification, subscriptionRemoved.
Outlook also sends another lifecycle notification, missed, if a notification cannot be delivered to an app.
An app subscribing to notifications for Outlook resources, such as message and event, should listen to the subscriptionRemoved and missed signals:
- Upon receiving a subscriptionRemoved notification, the app should recreate the subscription in order to maintain a continuous flow.
- On receiving a missed notification, the app should resynchronize resource data using Microsoft Graph.
To receive lifecycle notifications, you can use the existing notificationUrl endpoint that already receives resource notifications, or you can register a separate lifecycleNotificationUrl to receive subscriptionRemoved and missed notifications in a separate endpoint.
After I subscribed to a user's calendar events, I get the changes notifications without any issues, but if I change the user's password I should get the lifecycleEvent notification subscriptionRemoved like it says above; however, after changing my password about 30 times I never got the notification. What could be the issue here? I couldn't find any more info about how to trigger the notification.
If it helps with anything I'm subscribing to the resource me/events with a changeType: "created,updated,deleted".
const subscriptionOptions = {
changeType: 'created,updated,deleted',
notificationUrl: `node-service-url/outlook-events/${userId}`,
resource: 'me/events',
expirationDateTime: 'someExpirationDateTime',
clientState: 'someClientState'
}
const subscription = await client
.api('/subscriptions')
.post(subscriptionOptions)