Reputation: 1503
Based on the description for the AddressEntry.Address Property, I expect the following to "return a String (string in C#) representing the e-mail address of the AddressEntry."
Outlook.AddressList gal = Application.Session.GetGlobalAddressList();
Outlook.AddressEntries ae = gal.AddressEntries;
List<string> email = new List<string>();
foreach (Outlook.AddressEntry e in ae)
{
email.Add(e.Address);
}
Rather, the email list fills up with strings that look like...
"/o=companyName/ou=Exchange Administrative Group (FYDIBOHF23SPDLT)/cn=Recipients/cn=firstname.lastname"
I would prefer it return something like....
[email protected]
How am I using this incorrectly?
Upvotes: 1
Views: 522
Reputation: 66286
If AddressEntry.Type == "EX"
, use AddressEntry.GetExchangeUser().PrimarySmtpAddress
. Be prepared to handle nulls and exceptions.
Upvotes: 2