Outlook 2007 : How to obtain Proxy addresses using Outlook Object Model (for an ExchangeUser Object)?
Earlier i had a requirement, how to obtain Proxy addresses for a specific user programmatically'; also they preferred to do this by using Outlook Object Model API.
Please Note:
- The ExchangeUser object does not directly expose the proxy addresses for the user.
- However, you can use the PropertyAccessor object to obtain the MAPI property PR_EMS_AB_PROXY_ADDRESSES.
- This property is a multi-valued string property that contains all the foreign addresses for a given user.
Here is a simple code snippet, which returns an array of strings containing the proxy addresses for the ExchangeUser object passed as a method argument.
private string[] GetProxyAddresses(Outlook.ExchangeUser exchUser)
{
const string PR_EMS_AB_PROXY_ADDRESSES = "https://schemas.microsoft.com/mapi/proptag/0x800F101E";
if (exchUser != null)
{
return exchUser.PropertyAccessor.GetProperty(
PR_EMS_AB_PROXY_ADDRESSES) as string[];
}
else
{
throw new ArgumentNullException();
}
}
Hope this helps.