'VBA: how can I get a list of the SMTP email addresses for the current outlook user?
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!
Solution 1:[1]
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)
Solution 2:[2]
Read the PR_EMS_AB_PROXY_ADDRESSES
MAPI property (DASL name http://schemas.microsoft.com/mapi/proptag/0x800F101F
) using Namespace.CurrentUser.AddressEntry.PropertyAccessor.GetProperty
.
Each address will be prefixed with the address type (e.g. "EX:" or "smtp:"). The default SMTP address will be prefixed with "SMTP:" (all capitals).
You can see the property in OutlookSpy (I am its author) - click IMAPISession button, then QueryIdentity
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Bob |
Solution 2 | Dmitry Streblechenko |