Enumerating PR_MESSAGE_RECIPIENTS via ExtractProperty

I am enumerating senders/recipients of emails in a PST but want to avoid using .ExtractMessage for performance reasons. I can use .ExtractProperty to obtain PR_SENDER_EMAIL_ADDRESS_W but when I extract PR_MESSAGE_RECIPIENTS it always returns null despite there being recipients.

Can anyone provide guidance on how to extract the recipients from an email without the overhead of .ExtractMessage?

Code looks somewhat like this…

foreach (MessageInfo msgInfo in folder.EnumerateMessages())
{
// Extract Date/Time
MapiProperty propSubmitTime = pst.ExtractProperty(msgInfo.EntryId, MapiPropertyTag.PR_CLIENT_SUBMIT_TIME);
DateTime dt = propSubmitime.GetDateTime();

// Extract Sender
MapiProperty propSenderAddress = pst.ExtractProperty(msgInfo.EntryId, MapiPropertyTag.PR_SENDER_EMAIL_ADDRESS_W);

// Extract Recipients
MapiProperty propRecipients = pst.ExtractProperty(msgInfo.EntryId, MapiPropertyTag.PR_MESSAGE_RECIPIENTS);

}

Hello @NY.UK,

Thank you for contacting Aspose.Email support forum.

According to the documentation, PR_MESSAGE_RECIPIENTS is not intended to get recipients. Each recipient is a separate object, so they cannot be retrieved with a single property.
Unfortunately, we don’t have a method to retrieve a collection of recipients separately, but we can consider implementing one.
Alternatively, you can use the PR_DISPLAY_TO property, however, it should be noted it only returns a string list of recipient’s display names.

Thanks Dmitry, in that case .ExtractMessage is the only way to go if I want to extract the recipient email addresses?

Yes, this is the only way now.
But we can create a ticket to implement retrieving the recipient collection in a separate method.

Hi Dmitry, if you could open a ticket that would be fantastic as it is very useful for me but I am sure others too.

Hello @NY.UK,

I have opened the new ticket:

Issue ID(s): EMAILNET-41346

Thanks.

1 Like