Generally while querying outlook message details in MS-Graph API, I have seen message headers available only for received mails covering the extensive information about the email and not for sent mails.
while digging the reason for this in internet the thing convinced me about no message headers for sent mails is that these details are added by the email server to the sent mails before posting it in to the receiver's inbox. but, for some cases I can see headers for sent mails with limited info in it (reference) which brings me here.
Message headers for sent mails are valuable to classify them based on the details it contains like the detail of auto response for the attached reference mail's graph data. however all the sent mails doesn't come up with message headers.
can some one explain in which specific case the sent mail tend to have message header in it? and Is there any way to get the Message headers for all sent mails in outlook?
The graph query I usually use to view outlook message details is:
https://graph.microsoft.com/v1.0/me/messages?$select=internetmessageheaders
PS: I claimed the mail to be sent not just as it was in sent Items but by verifying the sender and from addresses of the message which is me and there are more such cases available in my mailbox.
Just like with any MAPI property,
PR_TRANSPORT_MESSAGE_HEADERSis not guaranteed to be present. The property values is extracted from the MIME headers of the message. If the message has never been converted from the MIME format, the property will not be present. If it was converted (even if it is sent rather than received), the property may be present.The bigger question is, what exactly are you trying to extract from the headers? Chances are, whatever you are after, can be present in a dedicated MAPI property, which you can request in your Graph query. Take a look at the sent messages with OutlookSpy (I am its author) - click IMessage button to see all MAPI properties. Keep in mind that the property set available in the cached mode (in the local OST file used by Outlook) may be different from what the server contains (and that is what your Graph query sees). To see the properties available on the server, open the message in Outlook in the online mode (right click on the
PR_ENTRYIDproperty in theIMessagewindow in OutlookSpy, selectIMAPISession::OpenEntry, make sureMAPI_NO_CACHEflag is checked.