Last reviewed on March 9, 2015   —  6 Comments

A visitor wanted to export the sender address and other metadata exposed using the CFG at How to display the sender's email address in Outlook. The fields can be copied and pasted into Excel or Notepad, but can't be exported.

While simple VBA will get the sender and sender email as both are exposed in the object model, to get fields not in the object model, you need to use PropertyAccessor object.

This sample prints the properties exposed by the Extended-Properties CFG to the Debug window.


Option Explicit

Public Sub ShowCreatedDate()
Dim oItem As Object
Dim propertyAccessor As Outlook.propertyAccessor
Set oItem = Application.ActiveExplorer.Selection.Item(1)
Set propertyAccessor = oItem.propertyAccessor
Debug.Print "Sender Display name: " & oItem.Sender
Debug.Print "Sender address: " & oItem.SenderEmailAddress
Debug.Print "PR_INTERNET_MESSAGE_ID", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x1035001E")
Debug.Print "PR_LAST_VERB_EXECUTED", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x10810003")
Debug.Print "PR_LAST_VERB_EXECUTION_TIME", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x10820040")
Set oItem = Nothing
End Sub

The full list of available properties for email is below. Calendar, Contacts, Tasks, Journal, and Notes will each have their own Properties.

' Types of Properties
'Email Message Properties
"PR_MESSAGE_CLASS", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x001A001E")
"PR_SUBJECT", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x0037001E")
"PR_CLIENT_SUBMIT_TIME", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x00390040")
"PR_SENT_REPRESENTING_SEARCH_KEY", propertyAccessor.BinaryToString(propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x003B0102"))
"PR_SUBJECT_PREFIX PT_STRING8", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x003D001E")
"PR_RECEIVED_BY_ENTRYID", propertyAccessor.BinaryToString(propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x003F0102"))
"PR_RECEIVED_BY_NAME", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x0040001E")
"PR_SENT_REPRESENTING_ENTRYID", propertyAccessor.BinaryToString(propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x00410102"))
"PR_SENT_REPRESENTING_NAME", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x0042001E")
"PR_REPLY_RECIPIENT_ENTRIES", propertyAccessor.BinaryToString(propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x004F0102"))
"PR_REPLY_RECIPIENT_NAMES", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x0050001E")
    
"PR_RECEIVED_BY_SEARCH_KEY", propertyAccessor.BinaryToString(propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x00510102"))
"PR_SENT_REPRESENTING_ADDRTYPE", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x0064001E")
"PR_SENT_REPRESENTING_EMAIL_ADDRESS", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x0065001E")
"PR_CONVERSATION_TOPIC", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x0070001E")
"PR_CONVERSATION_INDEX", propertyAccessor.BinaryToString(propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x00710102"))
"PR_RECEIVED_BY_ADDRTYPE", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x0075001E")
"PR_RECEIVED_BY_EMAIL_ADDRESS", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x0076001E")
"PR_TRANSPORT_MESSAGE_HEADERS", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x007D001E")
"PR_SENDER_ENTRYID", propertyAccessor.BinaryToString(propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x0C190102"))
"PR_SENDER_NAME", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x0C1A001E")
    
"PR_SENDER_SEARCH_KEY", propertyAccessor.BinaryToString(propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x0C1D0102"))
"PR_SENDER_ADDRTYPE", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x0C1E001E")
"PR_SENDER_EMAIL_ADDRESS", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x0C1F001E")
"PR_DISPLAY_BCC", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x0E02001E")
"PR_DISPLAY_CC", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x0E03001E")
"PR_DISPLAY_TO", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x0E04001E")
"PR_MESSAGE_DELIVERY_TIME", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x0E060040")
"PR_MESSAGE_FLAGS", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x0E070003")
"PR_MESSAGE_SIZE", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x0E080003")
"PR_PARENT_ENTRYID", propertyAccessor.BinaryToString(propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x0E090102"))
    
"PR_MESSAGE_RECIPIENTS", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x0E12000D")
"PR_MESSAGE_ATTACHMENTS", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x0E13000D")
"PR_HASATTACH", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x0E1B000B")
"PR_NORMALIZED_SUBJECT", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x0E1D001E")
"PR_RTF_IN_SYNC", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x0E1F000B")
"PR_PRIMARY_SEND_ACCT", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x0E28001E")
"PR_NEXT_SEND_ACCT", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x0E29001E")
"PR_ACCESS", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x0FF40003")
"PR_ACCESS_LEVEL", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x0FF70003")
"PR_MAPPING_SIGNATURE", propertyAccessor.BinaryToString(propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x0FF80102"))
    
"PR_RECORD_KEY", propertyAccessor.BinaryToString(propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x0FF90102"))
"PR_STORE_RECORD_KEY", propertyAccessor.BinaryToString(propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x0FFA0102"))
"PR_STORE_ENTRYID", propertyAccessor.BinaryToString(propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x0FFB0102"))
"PR_OBJECT_TYPE", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x0FFE0003")
"PR_ENTRYID", propertyAccessor.BinaryToString(propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x0FFF0102"))
"PR_BODY", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x1000001E")
"PR_RTF_COMPRESSED", propertyAccessor.BinaryToString(propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x10090102"))
"PR_HTML", propertyAccessor.BinaryToString(propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x10130102"))
"PR_INTERNET_MESSAGE_ID", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x1035001E")
"PR_LIST_UNSUBSCRIBE", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x1045001E")
    
"N/A", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x1046001E")
"PR_CREATION_TIME", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x30070040")
"PR_LAST_MODIFICATION_TIME", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x30080040")
"PR_SEARCH_KEY", propertyAccessor.BinaryToString(propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x300B0102"))
"PR_STORE_SUPPORT_MASK", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x340D0003")
"N/A", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x340F0003")
"PR_MDB_PROVIDER", propertyAccessor.BinaryToString(propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x34140102"))
"PR_INTERNET_CPID", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x3FDE0003")
"SideEffects", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x80050003")
"InetAcctID", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x802A001E")
"InetAcctName", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x804F001E")
"RemoteEID", propertyAccessor.BinaryToString(propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x80660102"))
"x-rcpt-to", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x80AD001E")


Comments

  1. Alan says

    Cool, now where can I see Calendar, Contacts, Tasks, Journal, and Notes Properties? Microsoft couldn't simply document these!?
    Thank you.

  2. John Melissa says

    I must be missing some basic concept, but looking at the MFCMAPI page you reference, I see the format of the value for property accessor but I can't get to a list of the actual property ID to use. Can you offer any hints on how to use the MFCMAPI documentation to compile a list such as the one you provided for email properties?

    • Diane PoremskyDiane Poremsky says

      Open the data file in mfcmapi then the contacts folder then double click on one of the contacts - the property names are listed along with the type. Do the same for other items.

  3. Darren Jones says

    I have a problem that is driving me nuts.
    I would think this should be relatively easy.
    I am trying to use MFCMapi to find the property IDs for some custom fields for a macro that will pull data from the GAL.

    My company has a couple custom fields in each users GAL entry.
    So when you look at someone's Outlook properties you see fields like..
    First name, last name, initials, display name, alias, etc
    And then there is a number of custom fields.

    I have 2 company's I work for.
    When I use MFCMapi on one GAL I can see all the property fields easily.
    But on the GAL with the custom fields I can't see any of the custom fields and those are the ones I need to read.

    For example one field has a letter S for staff or a C for contractor.
    Why can't I see these fields and how do I export them?

  4. Paul says

    Hi Diane,

    I've been trying to get the PR_INTERNET_MESSAGE_ID to use in a VBA solution, so your code above was perfect!

    Thank you

Leave a Reply

Please post long or more complicated questions at OutlookForums by Slipstick.com.

If the Post Comment button disappears, press your Tab key.