0
votes

I am wanting to access the MAPI property PR_RECIPIENT_TRACKSTATUS_DELIVERY for each recipient when an email is sent.

On the Email send event, using the following code generates the error: Object does not support property "http://schemas.microsoft.com/mapi/proptag/0x5FF5000A".

private void MailItem_Send(object item, ref bool cancel)
{
   Outlook.MailItem mailItem = item as Outlook.MailItem;

   var recDelivery = "";
   foreach (Outlook.Recipient r in mailItem.Recipients)
   {
      try
      {
         recDelivery = r.PropertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x5FF5000A"); //PR_RECIPIENT_TRACKSTATUS_DELIVERY - generates error
      }
      catch (Exception ex)
      {
         recDelivery = ex.Message;
      }
   }
}

Is it possible using Outlook’s MAPI object model to access this property's data during the send event? If not is there a particular point in the Outlook mail item's state where the property data will become available? Noting the same error occurs if the email is explicitly saved (Outlook.MailItem.Save()) before trying to access the MAPI property.

Also, I am able to access the data from the PR_RECIPIENT_FLAGS property if added to the block of code above. e.g.

var recipientFlag = r.PropertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x5FFD0003"); //PR_RECIPIENT_FLAGS

Thank-you in advance.

1

1 Answers

0
votes

The property only really makes sense for the appointment responses. Do you see that property at a later time (e.g. when the message is moved to the Sent Items folder) in OutlookSpy or MFCMAPI? You can use Items.ItemAdd event on that folder to access the property after the message is sent.