Graph change notifications for Teams presence is very limited

Ron Avriel 31 Reputation points
2020-10-11T05:29:40.513+00:00

Hi,

Only a single Graph change subscription to Teams presence can be created. The second subscription fails with:

Status Code: Conflict
Microsoft.Graph.ServiceException: Code: ExtensionError
Message: Operation: Create; Exception:[Status Code: Conflict; Reason: A subscripton already exists. It must be deleted before a another can be made.]

There is workaround to subscribe to multiple users presence in a single subscription by setting the resource to:
Resource = $"communications/presences?$filter=id in ('{userId1}','{userId2}')"

However, this workaround is very limited because:

  1. Each time a user needs to be added or removed then the single subscription must be deleted and created again. Note that it is not possible to update the subscription with a new resource containing the new list of users. MS Graph silently ignores this update.
  2. If one user in the list cannot be subscribed, then the whole subscription fails without knowing which user failed.
  3. The number of users that can be subscribed this way is limited.

Is there another way to subscribe to multiple users presence effectively?
Are there any plans to allow multiple presence subscriptions ?
Are there any plans to allow an application (not delegated user) permission to subscribe to presence?

Thanks,
Ron

Microsoft Teams Development
Microsoft Teams Development
Microsoft Teams: A Microsoft customizable chat-based workspace.Development: The process of researching, productizing, and refining new or existing technologies.
2,820 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Josey Sandoval 1 Reputation point
    2020-10-13T19:42:50.147+00:00

    @Ron Avriel , as you've correctly noted, only one subscription per user can be created at a time (each subscription can include up to 650 targets/IDs). Presence subscriptions are best suited to scenarios such as a user monitoring the presence of frequent contacts or team mates. By creating subscriptions using multiple users, each subscribing to 650 separate targets, you can leverage the subscription API to monitor a larger number of users depending on your use case. However, it may be more effective for you to use the getPresencesByUserId API, batching IDs into a single request (again, up to 650). Here, you can make multiple requests with the same user.


  2. Charlie Chen 1 Reputation point
    2022-04-29T08:18:06.507+00:00

    Hi @Josey Sandoval

    May I ask a question about "By creating subscriptions using multiple users, each subscribing to 650 separate targets, you can leverage the subscription API to monitor a larger number of users depending on your use case"

    Do you mean every user can call the API to create a separate subscription? Which means it can work around creating more than 1 subscription for all users?

    0 comments No comments