1

I'm building a tool in which I need to send more than 2 messages in the same thread (the message have identical subject & recipients) using Microsoft Graph API with some interval of days between them.

The problem is that I cannot send a message in the same thread using the API, even though the subject & recipients are same, Outlook displays them as different threads (but on the recipients' side (Gmail side) - they belong to same thread).

I tried using conversationId (which I got in the first message) in the second message but they still ended up showing in different threads.

Is there any way in I can send messages in the same thread?

2
  • how did you retrieve messageid/conversationid after you sent the message using /microsoft.graph.sendmail endpoint. As it doesnt return any response , i was curious how did you retrieve them Commented Jun 16, 2019 at 15:26
  • @zee This GitHub issue posted describes a way to do this by adding a custom identifier and then querying for it: github.com/microsoftgraph/microsoft-graph-docs/issues/3766 Commented Nov 22, 2019 at 13:57

2 Answers 2

1

To send emails in one thread you should use createReply method where you provide messageId of a previously sent message.

The tricky part is that after you sent a message with send or sendMail API methods, you do not have access to messageId. Even if you create a message via create method, messageId will be different after sending it.

So the solution is to send the message and find it in 'Sent Items' folder to retreive messageId. I am doing this based on time, subject and receiver. There is also useful param $top.

With correct messageId you'll be able to create reply and send it in the same thread.

Sign up to request clarification or add additional context in comments.

Comments

0

According to your description, I assume you want to use the https://graph.microsoft.com/v1.0/groups/{id}/threads endpoint to send more than 2 messages in the same thread. Refer to this document,

A new conversation, conversation thread, and post are created in the group. Use reply thread or reply post to further post to that thread.

So we can use the replay endpoint to send message in the same thread.

4 Comments

In my use-case, creating groups is not feasible and it actually voids one of the requirement.
https://graph.microsoft.com/v1.0/me/microsoft.graph.sendmail for sending mail. I thought if I add conversation-id or thread-id in the subsequent request then the mails will go in the same thread.
We can use the replay endpoint to send message in the same thread
Actually, I did look up this API but I want to send some attachments too which is not possible according to documents.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.