问题
I know how to get the primary email address of the current user, but how can I get a full list of all their SMTP email addresses?
I'm looking for the information you can get when you right-click on a recipient in an email and go to "open outlook properties" and go to the "E-mail Addresses" tab
thanks!
回答1:
Read the PR_EMS_AB_PROXY_ADDRESSES
MAPI property (DASL name http://schemas.microsoft.com/mapi/proptag/0x800F101F
) using Namespace.CurrentUser.AddressEntry.PropertyAccessor.GetProperty
.
You can see the addresses in OutlookSpy - click IMAPISession button, click QueryIdentity
回答2:
and for those of you who've never used getProperty, the code looks like this -
Const PR_EMS_AB_PROXY_ADDRESSES As String = _
"http://schemas.microsoft.com/mapi/proptag/0x800F101F"
Dim NS As Outlook.NameSpace
Set NS = Application.GetNamespace("MAPI")
addresses = _
NS.CurrentUser.AddressEntry.PropertyAccessor.GetProperty(PR_EMS_AB_PROXY_ADDRESSES)
来源:https://stackoverflow.com/questions/51657174/vba-how-can-i-get-a-list-of-the-smtp-email-addresses-for-the-current-outlook-us