Forum Discussion
Filtering channel messages in a conversation by date range
I can use a filter query to retrieve chat messages for a specific date range. However, does the Graph API for channel messages in a conversation support filtering messages and replies by date range?
* I'm looking for filter options to retrieve messages and replies within a specific conversation in a teams channel such as the image below, and not the entire message of a channel.
The filter query that works for me in chat messages are these
- List Messages in a chat documentation:
- https://learn.microsoft.com/en-us/graph/api/chat-list-messages?view=graph-rest-1.0&tabs=http
- List chat messages filtered by last modified date range:
- https://graph.microsoft.com/v1.0/chats/19:2da4c29f6d7041eca70b638b43d45437@thread.v2/messages?$top=2&$orderby=lastModifiedDateTime desc&$filter=lastModifiedDateTime gt 2022-09-22T00:00:00.000Z and lastModifiedDateTime lt 2022-09-24T00:00:00.000Z
There's no filter query option for channel messages in a conversation that I can find for the below HTTP Request.
- https://learn.microsoft.com/en-us/graph/api/chatmessage-get?view=graph-rest-1.0&tabs=http
- HTTP Request: GET /teams/{team-id}/channels/{channel-id}/messages/{message-id}
- https://learn.microsoft.com/en-us/graph/api/chatmessage-list-replies?view=graph-rest-1.0&tabs=http
- HTTP Request: GET /teams/{team-id}/channels/{channel-id}/messages/{message-id}/replies
If filter option not supported, is there an alternative way to retrieve channel messages and replies in a conversation by date range?
1 Reply
- Prasad_Das-MSFT
Microsoft
Sean17, Graph API does not directly support filtering messages and replies by date range within a specific conversation. To achieve your requirements, we recommend you give your feedback in Teams Feedback Portal.
Thanks,
Prasad Das
------------------------------------------------------------------------------------------
If the response is helpful, please click "**Mark as Best Response**" and like it. You can share your feedback via Microsoft Teams Developer Feedback link. Click here to escalate.