Building, integrating, or customizing apps and workflows within Microsoft Teams using developer tools and APIs
Hi @Tenneti Sudheer Kumar
Your understanding aligns with the documented lifecycle for Microsoft Graph change notification subscriptions.
For Microsoft Teams presence subscriptions, the subscription lifetime is limited to a maximum of 1 hour. The subscription should be renewed before expirationDateTime by calling PATCH /subscriptions/{id} and updating expirationDateTime. If the subscription has already expired and the renewal request fails because the subscription no longer exists, the documented recovery approach is to create a new subscription using POST /subscriptions.
So the recommended lifecycle is:
- Create the subscription with
POST /subscriptions. - Renew it before
expirationDateTimeusingPATCH /subscriptions/{id}with a newexpirationDateTime. - If the subscription has already expired and can no longer be renewed, create a new subscription with
POST /subscriptions.
Please refer: Get change notifications for presence updates in Microsoft Teams
In practice, treating a 404 Not Found response during renewal as a recoverable condition is reasonable, provided the application then creates a replacement subscription and does not require manual intervention.
For your second question, I would not rely on changing the resource field viaPATCH.
The Update subscription documentation says the API is used to renew a subscription by extending its expiry time, and the request body table lists the properties that can be updated as expirationDateTime and notificationUrl. It does not list resource as an updatable property.
For presence bulk subscriptions, the supported resource format is:
/communications/presences?$filter=id in ('{id}', '{id}', ...)
and the bulk subscription is limited to a maximum of 650 user IDs.
Therefore, if the monitored user set changes, the safer and documented approach is:
- Create a new subscription with the updated
resourcefilter. - Start processing notifications from the new subscription.
- Delete or allow the old subscription to expire, depending on your overlap strategy.
I hope this information help.
If the answer is helpful, please click "Yes" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.