none
VB.NET Read "REPORT.IPM.Note.NDR" info RRS feed

  • Question

  • Hi all

    I'm trying to determine sender and time stamp for a returned postmaster message.

    I've determined it is not a standard IPM.Note, but rather REPORT.IPM.Note.NDR

    I have looked at it in Outlook Spy to determine field names I want to access, but the code I am using returns "nothing"

    Can anyone help/advise?

    Fields wanted are:

    PR_CLIENT_SUBMIT_TIME  (being date/time received/sent) & PR_SenderSimpleDispName_W (Display name of sender (or email address))

    Example code being used

                If FA_Temp_MailItem.MessageClass = "REPORT.IPM.Note.NDR" Then
                    Dim objUserProperty As Outlook.UserDefinedProperty

                    objUserProperty = FA_Temp_MailItem.UserProperties.Find("PR_SenderSimpleDispName_W")

                    MsgBox(objUserProperty.value) >> Errors here as nothing returned

    Tuesday, September 23, 2014 7:59 AM

Answers

  • Hello,

    It looks like you are trying to get Extended MAPI properties using the UserProperties class which contains UserProperty objects that represent the custom properties of an Outlook item. You can iterate over all user properties using the one-based index and see what properties are stored there.

    Instead, you need to use the PropertyAccessor class, see the corresponding property on Outlook items. The PropertyAccessor object is used to get and set item-level properties that are not explicitly exposed in the Outlook object model, or properties for the following non-item objects: AddressEntry, AddressList, Attachment, ExchangeDistributionList,ExchangeUser, Folder, Recipient, and Store.

    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

    As you may see you need to use the DASL scheme to get the value. You can find the corresponding DASL values in Extended MAPI viewer such Outlook Spy or MFCMAPI.  

    PR_SenderSimpleDispName_W  -  "http://schemas.microsoft.com/mapi/proptag/0x4030001F"

    PR_CLIENT_SUBMIT_TIME  - "http://schemas.microsoft.com/mapi/proptag/0x00390040"

    The Referencing Properties by Namespace article describes possible formats in depth. Also you may find the Best Practices for Getting and Setting Properties page helpful.

    The PropertyAccessor class provides the UTCToLocalTime method which converts the date-time value that is specified by Value and expressed in Coordinated Universal Time (UTC) to a value in local time.

    • Marked as answer by PGARROD Tuesday, September 23, 2014 11:05 AM
    Tuesday, September 23, 2014 10:39 AM

All replies

  • Hello,

    It looks like you are trying to get Extended MAPI properties using the UserProperties class which contains UserProperty objects that represent the custom properties of an Outlook item. You can iterate over all user properties using the one-based index and see what properties are stored there.

    Instead, you need to use the PropertyAccessor class, see the corresponding property on Outlook items. The PropertyAccessor object is used to get and set item-level properties that are not explicitly exposed in the Outlook object model, or properties for the following non-item objects: AddressEntry, AddressList, Attachment, ExchangeDistributionList,ExchangeUser, Folder, Recipient, and Store.

    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

    As you may see you need to use the DASL scheme to get the value. You can find the corresponding DASL values in Extended MAPI viewer such Outlook Spy or MFCMAPI.  

    PR_SenderSimpleDispName_W  -  "http://schemas.microsoft.com/mapi/proptag/0x4030001F"

    PR_CLIENT_SUBMIT_TIME  - "http://schemas.microsoft.com/mapi/proptag/0x00390040"

    The Referencing Properties by Namespace article describes possible formats in depth. Also you may find the Best Practices for Getting and Setting Properties page helpful.

    The PropertyAccessor class provides the UTCToLocalTime method which converts the date-time value that is specified by Value and expressed in Coordinated Universal Time (UTC) to a value in local time.

    • Marked as answer by PGARROD Tuesday, September 23, 2014 11:05 AM
    Tuesday, September 23, 2014 10:39 AM
  • Perfect. Thanks Eugene
    Tuesday, September 23, 2014 11:05 AM