get GAL email address

D

Derek

I have developed an add in for outlook 2003 using
microsoft.office.interop.outlook
I would like to get all of the email addresses from the Global address list
and display them in a text box. I can get to the Global address list and i
can get the properties shown below however i dont see the email address any
where how do i get the email address from the address lisr entry ?

StringBuilder sb = new StringBuilder();
Microsoft.Office.Interop.Outlook.AddressLists adl =
applicationObject.Session.AddressLists;
MessageBox.Show("address lists :- " + adl.Count);
foreach (Microsoft.Office.Interop.Outlook.AddressList ad in
adl)
{
if (ad.Name.ToString().ToLower().Equals("global address
list"))
{
MessageBox.Show(ad.Name.ToString());
foreach
(Microsoft.Office.Interop.Outlook.AddressEntry addressListEntry in
ad.AddressEntries)
{
sb.Append(addressListEntry.Name); //*allStaff
string a = addressListEntry.Address; //"/o=The
Blomfield Group/ou=BLOMFIELDST/cn=Recipients/cn=Distributionlists/cn=All
Staff" string

string b = addressListEntry.ID; //
string c =
addressListEntry.Members.Count.ToString();
string d = addressListEntry.Name; //
string e = addressListEntry.Type; // EX
 
D

Dmitry Streblechenko

Do you mean you see an EX type address that does no look like an SMTP
address?
EX address is a perfectly valid address, it is just, well, not an SMTP
address.
In Outlook 2007, use AddressEntry.GetExchangeUser, then read the
ExchangeUser.PrimarySmtpAddress property. Keep in midn that
AddressEntry.GetExchangeUser will return null for a non-EX address entry.
<plug> In Redemption (all versions of Outlook), all you need is the
RDOAddress.SmtpAddress property <plug>

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top