2

I have been trying to subscribe users presence to Microsoft graph api by using Microsoft graph beta sdk. I am able to subscribe one user successfully and also works fine like when i change status from Microsoft teams it changes as expected.

When I try to subscribe another user it says subscription already exist. try deleting one to add another.

Is there any way to subscribe all users at once or i need to loop some other way around?

code :

var subscription = new Subscription
                {
                    ChangeType = "updated",
                    NotificationUrl = _applicationBaseUrl + "/Platform/presenceNotification",
                    Resource = $"/communications/presences/{id}",
                    ExpirationDateTime = DateTime.UtcNow.AddMinutes(2),
                    ClientState = tenantId
                };
await graphClient.Subscriptions
                    .Request()
                    .AddAsync(subscription);
bilal_khan
  • 79
  • 2
  • 9
  • Take a look at this https://developer.microsoft.com/en-us/graph/blogs/get-notified-of-presence-changes-the-microsoft-graph-presence-subscription-api-is-now-available-in-public-preview/ – b00n Sep 11 '20 at 09:39

1 Answers1

2

Yes you can ask for multiple ids, and you must write each ID in the request, MS is limiting you to a list of maximum 650 users.

The resource format is:

"/communications/presences?$filter=id in ('id1','id2',...)";
David Buck
  • 3,752
  • 35
  • 31
  • 35