Q: Help on OL ObectModel (AddressEntries) needed pls

M

marco.prischmann

Hi,

I know the smtp-adresses of several persons and need to get the
information stored in other AdressEntry.fields. At the moment I do it
the following way:

smtpaddr = "[email protected]" 'e.g. for this addess...
Set oAddressList = oSession.AddressLists("Global Address List")
Set oRecipients = ns.CreateRecipient(smtpaddr)
oRecipients.Resolve
Set objAddrEntry =
oAddressList.AddressEntries(oR­­­­ecipients.NAME)
'This is the point: Here indexing by .NAME, won't work when more
receipients with the same name exist
postalcode = objAddrEntry.Fields(CdoPR_POST­­­­AL_CODE) 'e.g. get
the Postal_Code

How can I address the addressEntry by an other information than by
name? This doesn't work correctly if more than on receipient with this
name exists.

Thx!

marco
 
D

Dmitry Streblechenko

Why do you even need to access AddressList at all? If you have a resolved
recipient, Recipient.AddressEntry will give you what you need:

smtpaddr = "[email protected]" 'e.g. for this addess...
Set oAddressList = oSession.AddressLists("Global Address List")
Set oRecipients = ns.CreateRecipient(smtpaddr)
oRecipients.Resolve
Set objAddrEntry = oRecipients.AddressEntry
postalcode = objAddrEntry.Fields(CdoPR_POST­­­­AL_CODE) 'e.g. get the
Postal_Code


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

Hi,

I know the smtp-adresses of several persons and need to get the
information stored in other AdressEntry.fields. At the moment I do it
the following way:

smtpaddr = "[email protected]" 'e.g. for this addess...
Set oAddressList = oSession.AddressLists("Global Address List")
Set oRecipients = ns.CreateRecipient(smtpaddr)
oRecipients.Resolve
Set objAddrEntry =
oAddressList.AddressEntries(oR­­­­ecipients.NAME)
'This is the point: Here indexing by .NAME, won't work when more
receipients with the same name exist
postalcode = objAddrEntry.Fields(CdoPR_POST­­­­AL_CODE) 'e.g. get
the Postal_Code

How can I address the addressEntry by an other information than by
name? This doesn't work correctly if more than on receipient with this
name exists.

Thx!

marco
 
Top