Search code examples
microsoft-graph-apioutlook-restapimicrosoft-graph-mail

MS Graph API: is it possible to order mail messages by recipient(s)?


To tell the truth, I am a bit surprised I've failed to google the answer (not for MS Graph API, neither for MS Outlook REST API) - it looks like I am the only one who is faced the task to order the mail messages (for example, in Sent Items folder) by recipient.

In the manual, I see it is possible to order messages by sender; I can request something like

GET https://graph.microsoft.com/v1.0/me/messages?$orderby=from/emailAddress/address

or

GET https://graph.microsoft.com/v1.0/me/messages?$orderby=from/emailAddress/name,from/emailAddress/address

But what with the recipients, which are actually an array (even 3 arrays: toRecipients, ccRecipients and bccRecipients)?

I've tried all API requests I could imagine, but got only errors. Am I missing something?


Solution

  • Order by collections is not supported. Maybe, if recipients are well known, you can filter by them and do client side sorting. Not the most efficient but might do the job.