Reputation: 2588
I am writing an Outlook Interop application and I need to get the country / region entry from an exchange user object. It is not available through the public properties, is there any way to get it anyways?
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;
}
Upvotes: 3
Views: 2377
Reputation: 31651
You can use ExchangeUser.PropertyAccessor
to retrieve the Country property. You need a try/catch in case the property isn't present. See source reference and available Mail User Properties.
try {
licensee.Country = entry.PropertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x3A26001E");
}
catch { licensee.Country = ""; }
Upvotes: 3