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. Obtaining SMTP Address from Global Address Book

2. smtp email addresses in the Outlook global address list

3. Importing email addresses from Exchange's Global Address list

4. Obtaining SMTP Address from Global Address Book

5. smtp email addresses in the Outlook global address list

6. Email address from Global Address List

7. Global Address List to Personal Address List?

8. Change Show Names list so Outlook Address Bk is on top of Global Address List

9. Obtain Address Book For a given Address Entry within a Distribution List

10. Global Address List + Personal Address book disappear randomly


 
Powered by phpBB® Forum Software © phpBB Group