Forum Discussion

relkniw's avatar
relkniw
Brass Contributor
Oct 04, 2022

MS Graph API: subscribe presence for a large number of user

Hi everybody,

 

which possibilites do we have to do a perfomant subscribtion the MS Teams presence status for a large number (>5000) of users via the MS Graph API?

 

Thanks for your help.

Regards

Gerd

 

5 Replies

  • relkniw - 

    You can https://learn.microsoft.com/en-us/graph/api/subscription-post-subscriptions?view=graph-rest-1.0&tabs=http to receive change notifications when the requested type of changes occur to the specified resource in Microsoft Graph. - https://learn.microsoft.com/en-us/graph/api/subscription-post-subscriptions?view=graph-rest-1.0&tabs=http#presence

     

    • relkniw's avatar
      relkniw
      Brass Contributor
      Hi Meghana,

      I know that and I use that functionality:

      But how many user can I add to "userIsString" in this case?

      var sub = new Microsoft.Graph.Subscription
      {
      ChangeType = "updated",
      NotificationUrl = Config.CurrentValue.CallBackUrl + ConfigurationConstants.CallbackSuffixPresenceNotifications,
      Resource = $"/communications/presences?$filter=id in {userIdsString}",
      //Resource = $"/communications/presences/{pUserId}",
      ExpirationDateTime = DateTime.UtcNow.AddMinutes(Config.CurrentValue.PresenceSettings.SubscriptionTimeout),
      ClientState = Config.CurrentValue.SecretClientState,
      };

      var newSubscription = await graphUserClient
      .Subscriptions
      .Request()
      .AddAsync(sub);

      Regards

      Gerd


      • Meghana-MSFT's avatar
        Meghana-MSFT
        Former Employee
        As per the note in https://learn.microsoft.com/en-us/graph/api/cloudcommunications-getpresencesbyuserid?view=graph-rest-1.0&tabs=http#permissions, Maximum of 650 user IDs are supported per API request.

Resources