How to determine if email address maps to a distribution (C# .NET)

Is there any way to determine if an email address maps to a distribution list when I’m reading the email from a PST?

Thanks,
//Christopher

Hi Christopher,


Can you please elaborate your requirements as to what you mean from mapping the email address to a distribution list? The API supports working with Distribution List in a PST but we are not sure if your requirements can be fulfilled as these are not clear to us. Please share your feedback with us for further assistance.

When I open an MSG file, and read the recipients list or read the Mapi properties of each recipient, is there a way to determine if any particular recipient is a distribution list. If any of the recipients are a distribution list, is there a way to determine who was in that distribution list?

Thanks,
//C

Hi Chirstopher,
We have tested this issue by sending out an email to a distribution list. However, the sent as well as 

received messages contains the individual emails of the distribution list and not a distribution list name. Thus,
we are not able to find any such way to determine if the contacts found belong to a distribution list or not. Could
you please share with us if sending an email message to a distribution list retains the list name? If possible, please
share such a sample file for our reference.

There appears to be a Mapi property for the recipient which designates the recipient as a D-List. I have attached an example. I’m curious, how do I look up and find the D-List in the PST?

Thanks,
//C

Hi Christopher,


Thank you for contacting us again.

MapiRecipient.getRecipientClass() function can be used to retrieve the information about distribution list. You may please give a try to the following sample code which displays the distribution list status of each recipient. I am afraid that there is no mechanism available which can be used to find other members in this distribution list in PST. Please feel free to share your feedback with us in this regard.


MapiMessage mapi = MapiMessage.fromFile(“Sample.MSG”);

for(MapiRecipient recp : mapi.getRecipients())

System.out.println(recp.getRecipientClass());

I have a related question. I need to find the number of recipients for each email. I need to iterate over the to, cc and bcc lists. Also, any entry may be a distribution list and in fact distribution lists may be nested within other distribution lists.
I’m trying to determine how to do this (and efficiently). I am currently opening my local ost file and therefore not logged into my corporate exchange server. Do I need to be logged in to do this?
How can I best accomplish my overall goal?

TIA
-M

@malamut,

I have observed your requirements and like to share that there is no other way to then to iterate the emails and getting recipient lists.

Thanks - I have 2 follow-up questions:

  1. How can I determine if a recipient is an individual or distribution list?
  2. How can I expand a distribution list to get all of the recipients in that list?

@malamut,

I like to inform that you can use EWS client to check and expand Distribution Lists. Please visit this documentation link for more details.