Search code examples
vb.netemailoutlookemail-headersmailitem

Get concise email header Outlook Mailitem VB.Net


I am catching the outlook mailItem after its being sent. I would like to get the email header i.e. To, From, CC, Subject, Body etc. I have tried using

Const PR_TRANSPORT_MESSAGE_HEADERS = "http://schemas.microsoft.com/mapi/proptag/0x007D001E"
tempVar = Item.PropertyAccessor.GetProperty(PR_TRANSPORT_MESSAGE_HEADERS)
                MsgBox(tempVar)

but that returns the whole header. Is there a way to get concise header information instead of trying to parse the string returned from the PropertyAccessor using PR_TRANSPORT_MESSAGE_HEADERS?


Solution

  • Why do you neeed to use the trasport headers?

    Instead, you can get all property values using the Outlook object model. Take a look at the corresponding properties of the MailItem class: To, CC, Recipients, Body.