[E2010] [EWSMA] [C#] - EmailMessage of an Undelivarable mail notification does not have the DateTimeReceived property set RRS feed

  • Question

  • When finding items from a Exchange 2010 server journaling inbox, there are some notifications on undelivered mails.

    When processing these emails, when trying to read the DateTimeReceived property, i get an ServiceObjectPropertyException with the error "You must load or assign this property before you can read its value".

    Is there a way of identifying such emails, or loading the DateTimeReceived property (even to be null)?



    Monday, May 23, 2011 12:15 PM

All replies

  • It should in general get loaded what does your code look like ? These emails where the datetime isn't showing where they imported from somewhere else if you look at the item using a Mapi editor like MFCmapi do you see the PR_MESSAGE_DELIVERY_TIME set ?


    Tuesday, May 24, 2011 3:34 AM
  • My Code is something like this:


    FindItemsResults<Item> mails= folder.FindItems(searchConditions, countConstraint);
    foreach (Item item in mails)
     EmailMessage email = (EmailMessage)item;
     DateTime receivedTime = email.DateTimeReceived;


    Those emails are from a journaling mailbox that has a copy of monitored mailbox every email sent to it.

    The specific emails that do not have this property, are notifications about emails sent from one of those mailboxes, but could not be delivered.

    Through MFCMapi i was able to view the message, and the PR_MESSAGE_DELIVERY_TIME property is set.



    Tuesday, May 24, 2011 6:12 AM
  • Okay sounds strange here's two thing i would try the first is defined a propertyset and props you want to load eg
    PropertySet psPropSet = new PropertySet(BasePropertySet.FirstClassProperties);
    The other thing would be try to load the ExtendedProperty Directly eg
            ExtendedPropertyDefinition PR_MESSAGE_DELIVERY_TIME = new ExtendedPropertyDefinition(3590, MapiPropertyType.SystemTime);
            object PropVal = null;
            if(it.TryGetProperty(PR_MESSAGE_DELIVERY_TIME,out PropVal)){
    Wednesday, May 25, 2011 2:59 AM
  • Thanks a lot for your help glen.

    Sadly, this didn't solve the issue either... even loading with FirstClassProperties and the ExtendedProperties did not set the DateTimeReceived property on these emails..

    I tried filtering out messages with the  REPORT.IPM.Note.NDR property (building on your blog post here )

    but that didn't work either...

    Thursday, May 26, 2011 2:46 PM