Obtaining email addresses from Global Address List 
Author Message
 Obtaining email addresses from Global Address List

Hello,

I currently am running Exchange Server with no more than 15 Global
Addresses. Each account has an Exchange account and a SMTP email
account associated with it. Now, I need to go though all of the address
lists and find a certain email address.

I have the following code that gets all address lists and reviews each
entry:

  Set out = CreateObject("Outlook.Application")
  Set mapi1 = out.GetNameSpace("MAPI")

  List1.AddItem mapi1.AddressLists.Count
  For ctrlists = 1 To mapi1.AddressLists.Count
    List1.AddItem mapi1.AddressLists(ctrlists).Name
    Set a = mapi1.AddressLists(ctrlists)

    Set oAdrEntries = a.AddressEntries
    For Each oAdrEntry In oAdrEntries
        List1.AddItem "   " & oAdrEntry.Type & " " & oAdrEntry.Name&
        _ "-" & oAdrEntry.address
    Next
  Next

What I get is a list like:
"EX" "testname" "/o=Company/ou=Domain/cn=Recipients/cn=gsnow"

This entry does have a smtp address associated with it as well though,
and I can not get to it.

Any ideas?

--

Advantrics LLC
www.advantrics.com

Sent via Deja.com
http://www.*-*-*.com/



Sat, 26 Jul 2003 09:48:44 GMT  
 Obtaining email addresses from Global Address List
Is this the only way ?????

And cdo isn't default installed with office, right ?

Are you sure that there isn't an other way ?

Thanks
Georgios


Quote:
> You need to use CDO (see http://www.cdolive.com ) and AddressEntry CDO
object.
> Use AddressEntry.Fields collection to grab either &H39FE001E property
(default
> SMTP address) or PR_EMS_AB_PROXY_ADDRESSES property(&H800F101E) - an array
of
> all available addresses.

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



> > Hello,

> > I currently am running Exchange Server with no more than 15 Global
> > Addresses. Each account has an Exchange account and a SMTP email
> > account associated with it. Now, I need to go though all of the address
> > lists and find a certain email address.

> > I have the following code that gets all address lists and reviews each
> > entry:

> >   Set out = CreateObject("Outlook.Application")
> >   Set mapi1 = out.GetNameSpace("MAPI")

> >   List1.AddItem mapi1.AddressLists.Count
> >   For ctrlists = 1 To mapi1.AddressLists.Count
> >     List1.AddItem mapi1.AddressLists(ctrlists).Name
> >     Set a = mapi1.AddressLists(ctrlists)

> >     Set oAdrEntries = a.AddressEntries
> >     For Each oAdrEntry In oAdrEntries
> >         List1.AddItem "   " & oAdrEntry.Type & " " & oAdrEntry.Name&
> >         _ "-" & oAdrEntry.address
> >     Next
> >   Next

> > What I get is a list like:
> > "EX" "testname" "/o=Company/ou=Domain/cn=Recipients/cn=gsnow"

> > This entry does have a smtp address associated with it as well though,
> > and I can not get to it.

> > Any ideas?

> > --

> > Advantrics LLC
> > www.advantrics.com

> > Sent via Deja.com
> > http://www.deja.com/



Mon, 04 Aug 2003 01:37:01 GMT  
 Obtaining email addresses from Global Address List
Yes, it is the only way unless you want to use C++/Delphi and Extended MAPI.
Doing in it in Extended MAPI (if you had any experience with it) is extremely
easy (in Delphi, assuming AddrEntry is your AddressEntry object):

const PR_DEFAULT_ADDRESS = $39FE001E;
var pProp : PSPropValue;
...
if S_OK = HrGetOneProp(AddrEntry.MAPIOBJECT, PR_DEFAULT_ADDRESS, pProp) then
begin
  strEMail := pProp.Value.lpszA;
  MAPIFreeBuffer(pProp);
end;

CDO is not installed by default by Outlook 2000 unless you upgrade from Outlook
97/98. You can however distribute and install CDO:
http://www.microsoft.com/exchange/downloads/CDO.htm

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


Quote:
> Is this the only way ?????

> And cdo isn't default installed with office, right ?

> Are you sure that there isn't an other way ?

> Thanks
> Georgios



Mon, 04 Aug 2003 02:24:28 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. smtp email addresses in the Outlook global address list

2. Obtaining SMTP Address from Global Address Book

3. Print Members in Global Address List or Personal Address book

4. VBA Outlook, sender's email, and Global address book

5. Too long to obtain the address list

6. Retrieve SMTP email addresses of GAB address entries

7. deletes a certain email address from address book

8. : TCP/IP address via email address

9. Mail server's address from Email address

10. Address Book and Email Address

11. : TCP/IP address via email address

12. How to get the Global Address List from Outlook

 

 
Powered by phpBB® Forum Software