我正在编写一个Outlook Interop应用程序,我需要从Exchange用户对象获取country / region条目。它不能通过公共财产获得,有什么方法可以获得它吗?
ExchangeUser entry = OutlookManager.Instance.GetAddressBookEntry(mail.SenderName, mail.SenderAddress);
if (entry != null)
{
var licensee = new Licensee();
licensee.City = entry.City;
licensee.Company = entry.CompanyName;
//todo get country
licensee.Country = ???
licensee.Department = entry.Department;
licensee.FirstName = entry.FirstName;
licensee.LastName = entry.LastName;
licensee.OutlookDisplayName = entry.Name;
}
答案 0 :(得分:1)
您可以使用ExchangeUser.PropertyAccessor
来检索国家/地区属性。如果该属性不存在,您需要try / catch。请参阅source reference和Mail User Properties。
try {
licensee.Country = entry.PropertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x3A26001E");
}
catch { licensee.Country = ""; }