Here are the basic questions I have about Outlook add-in development:
Are SMTP MIME headers available for all mail items? Even "internal" Exchange emails (Exchange user to Exchange user)?
I'm using the following code to get the headers, but I'm not sure if it's reliable:
mailItem.PropertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x007D001E");
Do these headers always include valid, SMTP email addresses in the From:, CC:, and similar fields? For example:
From: "Darth Vader" <[email protected]> To: "Palpatine" <[email protected]> CC: "Boba Fett" <[email protected]>, "IG-88" <[email protected]>, "Bossk" <[email protected]>
As opposed to Active Directory Distinguished Names, like...
From: /O=EMPIRE PARTNERS/OU=EXCHANGE ADMINISTRATIVE GROUP (FYDIBOHF23SPDLT)/CN=RECIPIENTS/CN=VADER, DARTHBC4 TO: /O=EMPIRE PARTNERS/OU=EXCHANGE ADMINISTRATIVE GROUP (FYDIBOHF23SPDLT)/CN=RECIPIENTS/CN=PALPSBC4
And here's more context to clarify these questions:
I'm developing an Outlook Add-in that displays alongside each email in Outlook. It is a sidebar that shows information about all the participants in the current email thread. My add-in requires the SMTP email addresses of the participants.
This is all fine - unless the users on the thread are Exchange users. In that case, Outlook does not give me direct access to their SMTP address. I have to follow a process similar to this post: Extract SMTP address from Exchange User in the FROM field of a message
String addressString = null;
try
{
ExchangeUser exchangeUser = address.GetExchangeUser();
if (exchangeUser != null)
{
addressString = exchangeUser.PrimarySmtpAddress;
}
} catch {
}
if (addressString == null)
{
addressString = address.Address;
}
The problem with this is, if the user's Exchange Server connection is broken or laggy, then resolving this User to an SMTP address can be slow. It can even freeze Outlook entirely.
So back to my original questions - Can I reliably expect the Email headers to be available, and if so, do those headers always contain valid SMTP email addresses?
Thanks for any advice.