Q: Help on OL ObectModel (AddressEntries) needed pls

  • Thread starter Thread starter marco.prischmann
  • Start date Start date
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 = "(e-mail address removed)" '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
 
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 = "(e-mail address removed)" '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 = "(e-mail address removed)" '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
 
Back
Top