How to subscribe to messages in a channel that mention several users? (Graph API)

Alexander Schreiber
21
Reputation points
Hi everybody!
There is the possibility to subscribe for notifactions, when a user is mentioned in a new message in a team channel (https://learn.microsoft.com/en-us/graph/teams-changenotifications-chatMessage#example-3-subscribe-to-messages-and-replies-in-a-channel-without-resource-data)
I have the requirement to make a subscription for several users and want to expand the filter statement with a or operator:
/teams/team-id/channels/channel-id/messages?$filter=mentions/any(u:u/mentioned/user/id eq 'userid1') or mentions/any(u:u/mentioned/user/id eq 'userid2')
Unfortunately I get following error:
{
"error": {
"code": "ExtensionError",
"message": "Operation: Create; Exception: [Status Code: BadRequest; Reason: Unable to parse filter parameter. Only supporting EQ and IN for filter statement.]",
"innerError": {
"date": "2021-07-06T09:07:20",
"request-id": "xxxxx",
"client-request-id": "xxxxx"
}
}
}
How can I declare a filter statement with more then one user?
Thanks in advance!
Regards
Alex
{count} votes
Hi @Diana Wanjuhi ,
thanks for your answer.
Here is the request-id: bbec3e98-db49-4dc5-bddd-a961d4b17504
Hope this helps!
Thank you!
Hi @Diana Wanjuhi ,
any news for me?
Thank you!
Hi @Diana Wanjuhi ,
II still have the problem. Did you had to chance to look at the issue?
It would be great, if you can help me.
Thanks a lot!
Regards
Alex
Hi @Alexander Schreiber
Could you please try to change the filter query as below and try it out?
/teams/team-id/channels/channel-id/messages?$filter=mentions/any(u:u/mentioned/user/id in ('userid1' , 'userid2'))
Hope it works !
IIt is working the way you described it!
Thank you very much!!!
Thanks for your update. Good to hear that it worked.
If the response is helpful, please click "Accept Answer" and upvote it.
Sign in to comment
Try to change the filter query as below :
/teams/team-id/channels/channel-id/messages?$filter=mentions/any(u:u/mentioned/user/id in ('userid1' , 'userid2'))
Thanks,
Prasad Das
If the response is helpful, please click "Accept Answer" and upvote it. You can share your feedback via Microsoft Teams Developer Feedback link. Click here to escalate.
Sign in to comment
0 additional answers
Sort by: Most helpful