VBA: how can I get a list of the SMTP email addresses for the current outlook user?

烂漫一生 提交于 2019-12-11 15:17:03

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!