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

Alexander Schreiber 21 Reputation points
2021-07-06T09:22:00.85+00:00

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

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,379 questions
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.
3,048 questions
{count} votes

Accepted answer
  1. Prasad-MSFT 6,076 Reputation points Microsoft Vendor
    2021-07-29T09:51:47.383+00:00

    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.

    0 comments No comments

0 additional answers

Sort by: Most helpful