I am using MS Graph API for fetching the user's presences, now i am stuck at fetching multiple subscriptions. e.g. If i have 10 users in my teams tenant, i want to get subscriptions for their presences, so that when someone's presence changed i will get a subscription. The method i am using is working fine for single user. When i give single user id in resources, subscription works fine but for multiple users, am unable to use the filter clause which mentioned in many documents. Now now i need to add "/communications/presences?$filter=id in ({id},{id}…) (multiple users)" but am confused as it gives me invalid filter clause error if i add filter('') in it.
Below is the code :
public getMSTeamsSubscriptionForPresence(ids) {
try {
let obj =
{
"changeType": "Updated",
"resource": "/communications/presences/tenant ID",
"expirationDateTime": "2021-12-21T17:50:39.2257768+00:00",
"clientState": "secretClientState",
"notificationUrl": this.configService.apiUrl + /teams,
}
return this.graphClient.api("/subscriptions").post(obj);
// }
}
catch (err) {
console.log('error while getting subscription ', err);
}
}
I am using MS Graph API for fetching the user's presences, now i am stuck at fetching multiple subscriptions. e.g. If i have 10 users in my teams tenant, i want to get subscriptions for their presences, so that when someone's presence changed i will get a subscription. The method i am using is working fine for single user. When i give single user id in resources, subscription works fine but for multiple users, am unable to use the filter clause which mentioned in many documents. Now now i need to add "/communications/presences?$filter=id in ({id},{id}…) (multiple users)" but am confused as it gives me invalid filter clause error if i add filter('') in it. Below is the code : public getMSTeamsSubscriptionForPresence(ids) { try { let obj = { "changeType": "Updated", "resource": "/communications/presences/tenant ID", "expirationDateTime": "2021-12-21T17:50:39.2257768+00:00", "clientState": "secretClientState", "notificationUrl": this.configService.apiUrl +
/teams
, } return this.graphClient.api("/subscriptions").post(obj); // } } catch (err) { console.log('error while getting subscription ', err); } }