获取备用电子邮件地址

问题描述 投票:0回答:3

我使用 Office School/Work 帐户(而非 Microsoft 帐户)在家用 PC 上登录 Outlook。它看起来类似于 [email protected]

与此帐户关联的主要 SMTP 是 [email protected] 我可以通过以下方式以编程方式获取:

Application.Session.Accounts[1].CurrentUser.AddressEntry.GetExchangeUser().PrimarySmtpAddress

如何以编程方式获取工作帐户电子邮件地址 ([email protected])?

vba outlook vsto outlook-addin office-addins
3个回答
0
投票

这可能是个愚蠢的问题……

但万一其他人需要这样做,该信息可作为 MS Graph 中的 userPrincipalName 使用: https://graph.microsoft.com/v1.0/me


0
投票

您可以检查 ExchangeUser.Alias 属性,该属性返回表示

ExchangeUser
别名的字符串,例如:

Application.Session.Accounts[1].CurrentUser.AddressEntry.GetExchangeUser().Alias

0
投票

备用(称为代理)地址存储在

PR_EMS_AB_PROXY_ADDRESSES
(DASL 名称
"http://schemas.microsoft.com/mapi/proptag/0x800F101F"
)MAPI 属性中。它是一个多值(作为数组返回)字符串属性,可以通过
AddressEntry.PropertyAccessor.GetProperty
访问。每个地址都将以其类型为前缀,例如,
"EX:"
"smtp:"
等。默认的 SMTP 地址以
"SMTP:"
为前缀。

© www.soinside.com 2019 - 2024. All rights reserved.