Not all properties are available in the Outlook object model. Lowl-level properties are available using the PropertyAccessor.GetProperty method which returns an Object that represents the value of the property specified by SchemaName
. For getting transport headers you may use the following code:
Sub DemoPropertyAccessorGetProperty()
Dim PropName, Header As String
Dim oMail As Object
Dim oPA As Outlook.PropertyAccessor
'Get first item in the inbox
Set oMail = _
Application.Session.GetDefaultFolder(olFolderInbox).Items(1)
'PR_TRANSPORT_MESSAGE_HEADERS
PropName = "http://schemas.microsoft.com/mapi/proptag/0x007D001E"
'Obtain an instance of PropertyAccessor class
Set oPA = oMail.PropertyAccessor
'Call GetProperty
Header = oPA.GetProperty(PropName)
Debug.Print (Header)
End Sub
But in some cases you would need to use Extended MAPI for getting low-level properties because the OOM applies its own restrictions to them.