Dus*_*rek 2 outlook vsto exchange-server outlook-object-model outlook-addin
我使用VSTO作为我的Outlook加载项.目前我正在处理所有Outlook联系人的电子邮件地址.如果EmailAddress1Type是"SMTP",则ContactInfo的实例没有问题.
但是如何获取Exchange联系人的电子邮件地址(Email1AddressType ="EX")?
Redemption库对我来说不是解决方案,因为解决这个问题很昂贵.
先感谢您,
杜尚
这是MSDN参考链接和相应的示例代码:
private const string Email1EntryIdPropertyAccessor = "http://schemas.microsoft.com/mapi/id/{00062004-0000-0000-C000-000000000046}/80850102";
PropertyAccessor propertyAccessor = contactItem.PropertyAccessor;
object rawPropertyValue = propertyAccessor.GetProperty(Email1EntryIdPropertyAccessor);
string recipientEntryID = propertyAccessor.BinaryToString(rawPropertyValue);
Recipient recipient = contactItem.Application.Session.GetRecipientFromID(recipientEntryID);
if (null == recipient)
throw new InvalidOperationException();
bool wasResolved = recipient.Resolve();
if (!wasResolved)
throw new InvalidOperationException();
ExchangeUser exchangeUser = recipient.AddressEntry.GetExchangeUser();
string smtpAddress = exchangeUser.PrimarySmtpAddress;
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1532 次 |
| 最近记录: |