How to retrieve alternate e-mail addresses by using CDO

Dichiarazione di non responsabilità per contenuto KB ritirato

Il contenuto di questo articolo è riferito a prodotti per cui Microsoft non offre più il supporto. Questo articolo viene pertanto offerto "così com'è" e non sarà più aggiornato.


This article contains a Collaboration Data Objects (1.x) code sample that demonstrates how to access the PR_EMS_AB_PROXY_ADDRESSES field of the AddressEntry object. This property contains the foreign system e-mail addresses (alternate e-mail addresses).

More Information

You can see the list of foreign system e-mail addresses (alternate e-mail addresses) through Microsoft Outlook as follows:
  1. From the Outlook standard toolbar, click Address Book.
  2. Right-click a name from the Exchange Global Address List and click Properties.
  3. Click the E-mail Addresses tab.
Microsoft Exchange Server supports the following types of addresses:
  • Exchange
  • Microsoft Mail
  • MacMail
  • X.400
  • Internet
  • Lotus cc:Mail
  • Custom
Each recipient on a Microsoft Exchange Server can have one or more of these types of addresses. The Address property of the AddressEntry object returns the Exchange (EX) type e-mail address by default. To retrieve the other addresses, you can use the PR_EMS_AB_PROXY_ADDRESSES property.

Not all address book providers support the PR_EMS_AB_PROXY_ADDRESSESproperty. The Exchange Global Address List (GAL) does, and it is also present in Personal Address Book (PAB) entries that were copied from the Exchange GAL. Outlook Contact folders do not support this property.

The following Visual Basic code uses CDO (1.x) to access the

Sample code

   ' This code sample assumes a valid reference to CDO (1.x) library.
' To use CDO (1.0) library, however, you must declare all CDO objects
' variables as Object. For example, "Dim objSession As Object."

Option Explicit

' This constant is not included in the CDO (1.x) type library,
' so you must declare it explicitly or use the provided
' value directly.

Private Sub Command1_Click()
Dim objSession As MAPI.Session
Dim objMessage As MAPI.Message
Dim objRecip As MAPI.Recipient
Dim objField As MAPI.Field
Dim v

' Create Session object and Logon.
Set objSession = CreateObject("MAPI.Session")

' Show AddressBook and choose a recipient.
Set objMessage = objSession.Outbox.Messages.Add
Set objMessage.Recipients = objSession.AddressBook(OneAddress:=True)
Set objRecip = objMessage.Recipients(1)

' Show the display name and EX type address.
MsgBox "Display Name: " & objRecip.Name
MsgBox "Default Address: " & objRecip.Address

' Get the PR_EMS_AB_PROXY_ADDRESSES property.
Set objField = _

' PR_EMS_AB_PROXY_ADDRESSES is a multivalued property (PT_MV_TSTRING).
' Therefore, you need to extract the individual members.
For Each v In objField.Value
MsgBox "Foreign System Address: " & v

' Clean up and exit.
Set objMessage = Nothing
Set objRecip = Nothing
Set objField = Nothing
Set objSession = Nothing
Unload Me
End Sub

ID articolo: 196507 - Ultima revisione: 12 set 2005 - Revisione: 1