Outlook VSTO 中来自 CurrentUser.Address 的电子邮件地址格式不正确
Incorrect format of email address from CurrentUser.Address in Outlook VSTO
我正在尝试使用
获取当前用户的 Outlook 电子邮件地址
Globals.ThisAddIn.Application.Session.CurrentUser.Address;
这个显示的值有点像这样:
"/o=ExchangeLabs/ou=Exchange Administrative Group (xxxxxxxxx)/cn=Recipients/cn=xxxxxxxxxxxxxxxxx-[the beginning of my email address is here]"
第一个问题是邮箱地址被截断了。我一开始以为这是一个断点问题,但是修改字符串后我发现它只是默认被切断了。第二个是我只想要电子邮件地址值而不需要之前的所有数据。我可以编辑掉字符串,但我正在寻找获取值的正确方法。
这在用户通过 Exchange 登录时有效。
Globals.ThisAddIn.Application.Session.CurrentUser.AddressEntry.GetExchangeUser().PrimarySmtpAddress;
我正在为未通过 Exchange 登录的用户寻找等效项。
我找到了 Email Address of the Current User 但这是一个旧线程,而且所有的解决方案似乎都很老套。
检查 AddressEntry.Type
属性。如果是 "EX",则使用 GetExchangeUser().PrimarySmtpAddress
。否则只需阅读 Address
属性.
我正在尝试使用
获取当前用户的 Outlook 电子邮件地址 Globals.ThisAddIn.Application.Session.CurrentUser.Address;
这个显示的值有点像这样:
"/o=ExchangeLabs/ou=Exchange Administrative Group (xxxxxxxxx)/cn=Recipients/cn=xxxxxxxxxxxxxxxxx-[the beginning of my email address is here]"
第一个问题是邮箱地址被截断了。我一开始以为这是一个断点问题,但是修改字符串后我发现它只是默认被切断了。第二个是我只想要电子邮件地址值而不需要之前的所有数据。我可以编辑掉字符串,但我正在寻找获取值的正确方法。
这在用户通过 Exchange 登录时有效。
Globals.ThisAddIn.Application.Session.CurrentUser.AddressEntry.GetExchangeUser().PrimarySmtpAddress;
我正在为未通过 Exchange 登录的用户寻找等效项。
我找到了 Email Address of the Current User 但这是一个旧线程,而且所有的解决方案似乎都很老套。
检查 AddressEntry.Type
属性。如果是 "EX",则使用 GetExchangeUser().PrimarySmtpAddress
。否则只需阅读 Address
属性.