DI. Robin Olivaw
DI. Robin Olivaw

Reputation: 149

Find the email aliases a message was actually sent to

Is there a way to get the email aliases address to which an email was originally sent from Microsoft Graph?

We have a single email account like [email protected] along with the multiple other associated email addresses (email aliases). Emails send to any of the aliases go to a to the same inbox as [email protected].

If we send an email to [email protected] and look at the message using https://graph.microsoft.com/v1.0/me/messages, it shows [email protected] as the email address. We need to detect if it was sent to [email protected].

The information for the allies can be found in the email header and there is a potential workaround in the Outlook API:

https://outlook.office.com/api/v2.0/me/mailfolders/inbox/messages/{messageId}?$select=Subject,SingleValueExtendedProperties &$expand=SingleValueExtendedProperties($filter=PropertyId eq 'String 0x7D') 

This returns an unstructured result which needs to be parsed and it is not very convenient. We are looking if there is a more direct way to get this from Microsoft Graph.

Upvotes: 1

Views: 551

Answers (1)

Marc LaFleur
Marc LaFleur

Reputation: 33094

You can use the same $filter with Microsoft Graph. You simply need to switch PropertyId to simply id:

?$select=subject&$expand=singleValueExtendedProperties($filter=id eq 'String 0x7D')

Also note that don't need to both select and expand the singleValueExtendedProperties collection. Expanding will ensure it gets included.

Upvotes: 1

Related Questions