Search code examples
c#visual-studio-2008vstooutlook-addin

VSTO - Get BCC Recipient from Outlook.MailItem


I am creating an Outlook Addin project via VSTO in Visual Studio 2008 using the outlook 2007 template and c# .net version 3.5.

I need to collect all recipient emails addresses and I am doing this via the Outlook.MailItem.Recipients property. However, this does not seem to contain any addresses which have been entered into the email's BCC field. Is there a way to get this or is the fact that it is 'blind' mean that it is not available in any form?

The code I am using is as follows:

    private string GetEmailAddresses(Outlook.MailItem mail)
    {
        const string PR_SMTP_ADDRESS = "http://schemas.microsoft.com/mapi/proptag/0x39FE001E";
        string emailsFound = "";
        Outlook.Recipients recipients = mail.Recipients;

        foreach (Outlook.Recipient recipient in recipients)
        {
            Outlook.PropertyAccessor pa = recipient.PropertyAccessor;
            emailsFound += pa.GetProperty(PR_SMTP_ADDRESS).ToString() + "\n";
        }

        return emailsFound;
    }

Many thanks in advance!


Solution

  • BCC recipients are only available on the sent items in the Sent Items folder. BCC recipient will not be present on the incoming messages by definition.