Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get first email from conversation id using Microsoft Graph

Is it possible to query for the first, or all emails from a particular conversation id using the Microsoft Graph? If not, how about with the classic Exchange API?

Scenario: I am creating an application where I am interested in tracking the user who started an email thread, and the content of their initial message.

When querying for mail using the Microsoft Graph, I can get back an id unique to that email, and a conversationId unique to that email thread. The body returns the full email thread so far, but it is none trivial to parse (are there tips to parsing the returned HTML?), and may not always be accurate if people are adjusting the mail that gets sent back and forth.

Maybe the solution here is to parse the full body HTML, but I have not seen any documentation on best practices here. Any tips?

like image 978
Shawn Tabrizi Avatar asked Nov 30 '25 12:11

Shawn Tabrizi


1 Answers

To get all mails with same conversationId, you can use

GET https://graph.microsoft.com/v1.0/me/messages?$filter= conversationId eq 'yourConversationId'

Microsoft Graph is using OData. So you can use query parameters to customize responses.

For how to use query, please check this document.

like image 64
Hongbo Miao Avatar answered Dec 04 '25 18:12

Hongbo Miao



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!