Forum Discussion
How to get teams channel message from reply of a message id in ms graph?
Hi, I'm currently using the Microsoft Graph API to develop an app. I use https://graph.microsoft.com/v1.0/search/query to search for messages. I receive the results, which include both the original message and reply message. I want to use the message ID to retrieve the detailed message using this API: /teams/{team-id}/channels/{channel-id}/messages/{message-id}. If the message is the main message, it returns the details. However, if it's a reply, it returns a 404 error. Does this mean I need to obtain the main message ID from the reply? Is there any API or practical way I can use to retrieve it?
Thank you!
3 Replies
- bayusaurusCopper Contributor
I used search/query
for example I search for xsxsxs. the result will be showing these 2 message, one is the main message (1) and one is the reply of the main message (2)
GET https://graph.microsoft.com/v1.0/teams/{team-id}/channels/{channel-id}/messages/1612509044972/replies/1613671348387
let say this id 1612509044972 is for the main message (1) and this id 1613671348387 is for the reply of the main message (2).
I want to use this api to get the message detail, for the main message (1) id 1612509044972 it will success.
GET https://graph.microsoft.com/v1.0/teams/{team-id}/channels/{channel-id}/messages/1612509044972
if if I use reply of main message (2) id 1613671348387 it will return 404 not found.
GET https://graph.microsoft.com/v1.0/teams/{team-id}/channels/{channel-id}/messages/1613671348387
is there any way to get the detail message using the api above if I only have id of reply of main message (2)?
thank you
- Sayali-MSFT
Microsoft
Hello @bayusaurus,
When using the Microsoft Graph API to retrieve messages in Microsoft Teams, you may encounter a situation where you need to differentiate between main messages and replies. If you receive a 404 error when trying to retrieve a reply message using its message ID, it indicates that the API endpoint you are using is not designed to handle reply messages directly.
Could you please check with this Graph API-GET https://graph.microsoft.com/v1.0/teams/fbe2bf47-16c8-47cf-b4a5-4b9b187c508b/channels/19:4a95f7d8db4c4e7fae857bcebe0623e6@thread.tacv2/messages/1612509044972/replies/1613671348387
Reference Document-
Get chatMessage in a channel or chat - Microsoft Graph v1.0 | Microsoft Learn - Sayali-MSFT
Microsoft
Hello @bayusaurus, Thank you for your inquiry about your Teams app development issue!
We are checking the issue. We will get back to you shortly.