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
Const PT_LONG As String = "0003"
Const PT_STRING8 As String = "001E"
Const PT_SYSTIME As String = "0040"
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 "Message ID" & CheckBlankFields("PR_INTERNET_MESSAGE_ID", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x1035" & PT_STRING8))
Debug.Print "Last verb excuted: " & CheckBlankFields("PR_LAST_VERB_EXECUTED", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x1081" & PT_LONG))
Debug.Print "Last excuted time: " & CheckBlankFields("PR_LAST_VERB_EXECUTION_TIME", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x1082" & PT_SYSTIME))
Set oItem = Nothing
End Sub
Private Function CheckBlankFields(FieldName As String, FieldValue As Variant)
CheckBlankFields = ""
If (FieldValue "") <> Then
CheckBlankFields = FieldValue
End If
End Function
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
Const PT_BOOLEAN As String = "000B"
Const PT_BINARY As String = "0102"
Const PT_MV_BINARY As String = "1102"
Const PT_DOUBLE As String = "0005"
Const PT_LONG As String = "0003"
Const PT_OBJECT As String = "000D"
Const PT_STRING8 As String = "001E"
Const PT_MV_STRING8 As String = "101E"
Const PT_SYSTIME As String = "0040"
Const PT_UNICODE As String = "001F"
Const PT_MV_UNICODE As String = "101F"
'Email Message Properties
("PR_MESSAGE_CLASS", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x001A" & PT_STRING8))
("PR_SUBJECT", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x0037" & PT_STRING8))
("PR_CLIENT_SUBMIT_TIME", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x0039" & PT_SYSTIME))
("PR_SENT_REPRESENTING_SEARCH_KEY", propertyAccessor.BinaryToString(propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x003B" & PT_BINARY)))
("PR_SUBJECT_PREFIX PT_STRING8", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x003D" & PT_STRING8))
("PR_RECEIVED_BY_ENTRYID", propertyAccessor.BinaryToString(propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x003F" & PT_BINARY)))
("PR_RECEIVED_BY_NAME", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x0040" & PT_STRING8))
("PR_SENT_REPRESENTING_ENTRYID", propertyAccessor.BinaryToString(propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x0041" & PT_BINARY)))
("PR_SENT_REPRESENTING_NAME", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x0042" & PT_STRING8))
("PR_REPLY_RECIPIENT_ENTRIES", propertyAccessor.BinaryToString(propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x004F" & PT_BINARY)))
("PR_REPLY_RECIPIENT_NAMES", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x0050" & PT_STRING8))
("PR_RECEIVED_BY_SEARCH_KEY", propertyAccessor.BinaryToString(propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x0051" & PT_BINARY)))
("PR_SENT_REPRESENTING_ADDRTYPE", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x0064" & PT_STRING8))
("PR_SENT_REPRESENTING_EMAIL_ADDRESS", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x0065" & PT_STRING8))
("PR_CONVERSATION_TOPIC", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x0070" & PT_STRING8))
("PR_CONVERSATION_INDEX", propertyAccessor.BinaryToString(propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x0071" & PT_BINARY)))
("PR_RECEIVED_BY_ADDRTYPE", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x0075" & PT_STRING8))
("PR_RECEIVED_BY_EMAIL_ADDRESS", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x0076" & PT_STRING8))
("PR_TRANSPORT_MESSAGE_HEADERS", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x007D" & PT_STRING8))
("PR_SENDER_ENTRYID", propertyAccessor.BinaryToString(propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x0C19" & PT_BINARY)))
("PR_SENDER_NAME", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x0C1A" & PT_STRING8))
("PR_SENDER_SEARCH_KEY", propertyAccessor.BinaryToString(propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x0C1D" & PT_BINARY)))
("PR_SENDER_ADDRTYPE", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x0C1E" & PT_STRING8))
("PR_SENDER_EMAIL_ADDRESS", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x0C1F" & PT_STRING8))
("PR_DISPLAY_BCC", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x0E02" & PT_STRING8))
("PR_DISPLAY_CC", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x0E03" & PT_STRING8))
("PR_DISPLAY_TO", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x0E04" & PT_STRING8))
("PR_MESSAGE_DELIVERY_TIME", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x0E06" & PT_SYSTIME))
("PR_MESSAGE_FLAGS", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x0E07" & PT_LONG))
("PR_MESSAGE_SIZE", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x0E08" & PT_LONG))
("PR_PARENT_ENTRYID", propertyAccessor.BinaryToString(propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x0E09" & PT_BINARY)))
("PR_MESSAGE_RECIPIENTS", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x0E12" & PT_OBJECT))
("PR_MESSAGE_ATTACHMENTS", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x0E13" & PT_OBJECT))
("PR_HASATTACH", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x0E1B" & PT_BOOLEAN))
("PR_NORMALIZED_SUBJECT", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x0E1D" & PT_STRING8))
("PR_RTF_IN_SYNC", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x0E1F" & PT_BOOLEAN))
("PR_PRIMARY_SEND_ACCT", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x0E28" & PT_STRING8))
("PR_NEXT_SEND_ACCT", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x0E29" & PT_STRING8))
("PR_ACCESS", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x0FF4" & PT_LONG))
("PR_ACCESS_LEVEL", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x0FF7" & PT_LONG))
("PR_MAPPING_SIGNATURE", propertyAccessor.BinaryToString(propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x0FF8" & PT_BINARY)))
("PR_RECORD_KEY", propertyAccessor.BinaryToString(propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x0FF9" & PT_BINARY)))
("PR_STORE_RECORD_KEY", propertyAccessor.BinaryToString(propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x0FFA" & PT_BINARY)))
("PR_STORE_ENTRYID", propertyAccessor.BinaryToString(propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x0FFB" & PT_BINARY)))
("PR_OBJECT_TYPE", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x0FFE" & PT_LONG))
("PR_ENTRYID", propertyAccessor.BinaryToString(propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x0FFF" & PT_BINARY)))
("PR_BODY", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x1000" & PT_STRING8))
("PR_RTF_COMPRESSED", propertyAccessor.BinaryToString(propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x1009" & PT_BINARY)))
("PR_HTML", propertyAccessor.BinaryToString(propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x1013" & PT_BINARY)))
("PR_INTERNET_MESSAGE_ID", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x1035" & PT_STRING8))
("PR_LIST_UNSUBSCRIBE", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x1045" & PT_STRING8))
("N/A", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x1046" & PT_STRING8))
("PR_CREATION_TIME", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x3007" & PT_SYSTIME))
("PR_LAST_MODIFICATION_TIME", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x3008" & PT_SYSTIME))
("PR_SEARCH_KEY", propertyAccessor.BinaryToString(propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x300B" & PT_BINARY)))
("PR_STORE_SUPPORT_MASK", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x340D" & PT_LONG))
("N/A", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x340F" & PT_LONG))
("PR_MDB_PROVIDER", propertyAccessor.BinaryToString(propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x3414" & PT_BINARY)))
("PR_INTERNET_CPID", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x3FDE" & PT_LONG))
("SideEffects", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x8005" & PT_LONG))
("InetAcctID", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x802A" & PT_STRING8))
("InetAcctName", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x804F" & PT_STRING8))
("RemoteEID", propertyAccessor.BinaryToString(propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x8066" & PT_BINARY)))
("x-rcpt-to", propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x80AD" & PT_STRING8))

