Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best way to achieve Conversation view for mail folder using Outlook REST API

I would like to use the Outlook REST API to display the messages in a mail folder and group messages by conversations, like you have in any modern webmail.

For example with inbox, I would request using a first query such as <mailuri>/inbox/messages?$select=ConversationId (by default it is reverse chronological order)

It is not sufficient to group this request results by ConversationId because some emails may not be in inbox (think of sentmails) or they may be paginated and not returned in the first page.

Consequently, for each distinct ConversationId I need to perform another REST request, for retrieving participants or simply counting the emails in the conversation. I may use the new batch request to do this.

There are a lot of requests involved. Is there a better solution ?

like image 212
Benoit Patra Avatar asked Dec 20 '25 00:12

Benoit Patra


2 Answers

As you've probably realized the REST API doesn't directly provide a way to work with conversations as an entity. This is something that we have on our roadmap to improve.

With the current state of the API what you're describing is basically the right approach. You could possibly defer the second request to "fill in" a conversation until the user selects it.

like image 126
Jason Johnston Avatar answered Dec 21 '25 20:12

Jason Johnston


You can actually use this endpoint to cover both inbox and sentitems

https://outlook.office.com/api/v2.0/me/messages/?$select=ConversationId & $filter=ConversationId eq '${params.conversationId}'
like image 44
Dan Perry Avatar answered Dec 21 '25 20:12

Dan Perry



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!