VBA: Get programmatically the list of all possible email addresses starting from Display Name or UPN
Hello everybody
How could I get programmatically (with a VBA Excel macro) access to the Outlook properties of a single contact for whom I have the User Principal Name or the Display Name
I am interested in particular to the tab labelled "E-mail Addresses" of the Outlook Properties
I managed to get the PrimarySMTP property, but I would like to get the list of all addresses that are listed there. The 'alias' property only gives me one entry, while there are several others.
I managed to write some code to get the information concerning the distribution list membership information, this is what I did:
Dim objExchUsr As ExchangeUser
Dim myolApp As Outlook.Application
Dim myNameSpace As Namespace
Dim MyAddrList As AddressList
Dim myRecipient As Outlook.Recipient
Dim oDistListEntries As Outlook.AddressEntries
Dim oAE As Outlook.AddressEntry
Set myolApp = CreateObject("Outlook.Application")
Set myNameSpace = myolApp.GetNamespace("MAPI")
Set MyAddrList = myNameSpace.addressLists("Global Address List")
Set myRecipient = myNameSpace.CreateRecipient(strDisplayname)
myRecipient.Resolve
If myRecipient.Resolved Then
Set objExchUsr = myRecipient.AddressEntry.GetExchangeUser
Set oDistListEntries = objExchUsr.GetMemberOfList
For Each oAE In oDistListEntries
If oAE.AddressEntryUserType = olExchangeDistributionListAddressEntry Then
<Do something with the distribution lists: not relevant to this problem>
End If
Next
End If
While with this code I get the information shown in the tab 'Member Of' of the Outlook Properties, my problem is how to get the information that is shown in the tab 'E-mail Addresses'
Thank you in advance