Graph call to pull message header doesn't return To field

New Contributor

Wondering if anyone has come across the following:

 

Background

 

Because I want to perform some Power Automate magic on messages received in a shared mailbox, I have a need to extract the original To fields from the received messages.


Problem


Am using the following call to attempt to pull the full header off an email message stored in an Exchange Online user's mailbox:


https://graph.microsoft.com/v1.0/users/<user UPN>/mailFolders/<mail folder ID>/messages/<mail message ID>=?$select=Subject,InternetMessageHeaders


I receive back most of the header information.  Strangely, what is missing is the one piece of information that I am looking for which is the "To".  The reason I am trying to pull it this way is that once the message lands in its destination EOL is resolving the To field to items from Address Book.  Because of my need to do the Power Automate magic, I don't want the recipients as they resolved but rather the original contents of the message's To field as found in the raw header.

Before someone mentions it, I cannot simply use the To field that Power Automate provides out of the box because it is "post Address Book resolution".

Appreciate any thoughts the community may have.

 

2 Replies

Hi again @JohnnyQuest1965,

 

I forgot to say that in case a message has been BCCed, you cannot find any recipient address in the SMTP headers - that's normal.

 

Regards