Nad*_*lah 9 vsto ms-office outlook-addin
在我的VSTO Outlook 2007插件中,我可以获取作为交换用户的收件人的电子邮件地址.但是,当我有以下情况时,它不会返回smtp电子邮件:
以下是我的代码:
Recipient r = mailItem.Recipients[i];
r.Resolve();
//Note, i have different conditions that check the AddressEntryUserType of recipient's
//address entry object. All other cases work fine. In this case this is
//olOutlookContactAddressEntry.
//I have tried the following:
ContactItem cont = r.AddressEntry.GetContact();
string email = cont.Email1Address;
string emailtmp = r.AddressEntry.PropertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x800F101E") as string;
Run Code Online (Sandbox Code Playgroud)
任何人都可以请帮助我在这种情况下我应该使用什么属性来获取smtp电子邮件?
我找到了一种使用 ExchangeUser 项目并通过该对象解析 smtp 地址的方法。这篇文章有帮助 -从存储在 Exchange 中的 ContactInfo 获取 Smtp 电子邮件
foreach (Outlook.Recipient recipient in currentAppointment.Recipients)
{
Outlook.ExchangeUser exchangeUser = recipient.AddressEntry.GetExchangeUser();
string smtpAddress;
if (exchangeUser != null)
{
smtpAddress = exchangeUser.PrimarySmtpAddress;
}
else
{
smtpAddress = recipient.Address;
}
}
Run Code Online (Sandbox Code Playgroud)
如果我没记错的话,在某些情况下,除非您先保存要发送的项目,否则电子邮件地址将无法解析。你可以尝试一下。另外,您是否没有收到任何请求访问用户地址簿权限的“安全违规”消息,或者您是否禁用/解决了所有这些问题?我遇到了很多问题,最终需要使用 Outlook 的赎回。
| 归档时间: |
|
| 查看次数: |
4672 次 |
| 最近记录: |