首页新闻找找看学习计划

c#获取outlook发件人信息为空

0
[已解决问题] 解决于 2019-08-05 10:09

if (mail.SenderEmailType == "EX")
{
Outlook.AddressEntry sender = mail.Sender;
if (sender != null)
{
//Now we have an AddressEntry representing the Sender
if (sender.AddressEntryUserType == Outlook.OlAddressEntryUserType.olExchangeUserAddressEntry
|| sender.AddressEntryUserType == Outlook.OlAddressEntryUserType.olExchangeRemoteUserAddressEntry)
{
//Use the ExchangeUser object PrimarySMTPAddress
Outlook.ExchangeUser exchUser = sender.GetExchangeUser();
if (exchUser != null)
{
return exchUser.PrimarySmtpAddress; //debug定位到此处获取为空
}
else
{
return null;
}
}
else
{
return sender.PropertyAccessor.GetProperty(PR_SMTP_ADDRESS) as string;
}
}
else
{
return null;
}
}

return exchUser.PrimarySmtpAddress; //debug定位到此处获取为空,什么情况下才会出现获取exchange用户为空呢?

问题补充:

本地测试时正常,但是到了客户端,就一直获取不到Exchange的发件人邮箱地址。一直为空。

站在那看风景的主页 站在那看风景 | 菜鸟二级 | 园豆:369
提问于:2019-08-01 17:55
< >
分享
最佳答案
0

reinstall and reset the client outlook ,then this problem can be solved.

站在那看风景 | 菜鸟二级 |园豆:369 | 2019-08-05 10:08
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册