question

UmairAhmed-8282 avatar image
0 Votes"
UmairAhmed-8282 asked ShivaniRai-MSFT-7217 answered

When is a "subscriptionRemoved" lifecycle notification sent while subscribing to message resource in Office 365?

I am using Microsoft webhook change notifications to listen to new emails in user's mailbox. The notifications are subscribed as follows:

 {
  "changeType": "created",
  "notificationUrl": "{our-internal-api-endpoint}",
  "resource": "/me/messages",
  "expirationDateTime": "{expiry-time}",
  "clientState": "SecretClientState"
 }

As per documentation, Microsoft can send a subscriptionRemoved notification to indicate that a subscription has been removed by Microsoft itself but I am unable to understand or test the scenarios under which a subscription might be removed automatically. I tried changing a user's password as well as deleting the user from my testing tenant but didn't receive this notification.

Can someone please indicate the scenarios under which this lifecycle notification might be sent? For more information, we're developing a multi-tenant application with application permissions and we authorize the app using client credentials flow.


microsoft-graph-mailmicrosoft-graph-change-notifications
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

ShivaniRai-MSFT-7217 avatar image
0 Votes"
ShivaniRai-MSFT-7217 answered

Hi @UmairAhmed-8282 ,

According to this Documentation while creating a subscription, you must specify a notification endpoint using the lifecycleNotificationUrl property. If you specify the endpoint, all current and future types of lifecycle notifications will be delivered there. Otherwise, subscriptionRemoved and missed lifecycle notifications will not be delivered. This endpoint can be the same as the notificationUrl or a different one. Refer below screenshot:

175826-image.png

I can see that you have not set this property while creating subscription that is why you are not able to get lifecycle notifications.

And below are the scenarios which can cause a subscription to be removed:

  • User's password has been reset

  • User's device is out of compliance

  • User's account has been revoked

Hope this helps.

If the answer is helpful, please click Accept Answer and kindly upvote it. If you have any further questions about this answer, please click Comment.








image.png (54.6 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.