Search code examples
c#exchangewebservicesbcc

Exchange EWS get BCC Recipients


I am using EWS to create a StreamingSubscription on an inbox. It is listening for the NewMail event. I am able to pull the From Address, Subject, Body, To Address, CC Address but not the BCC Address. Is there any way to see this list?

CODE:

static void OnEvent(object sender, NotificationEventArgs args)
{
    String from = null;
    String subject = null;
    String body = null;
    String to = null;

    StreamingSubscription subscription = args.Subscription;

    // Loop Through All Item-Related Events
    foreach (NotificationEvent notification in args.Events)
    {
        ItemEvent item = (ItemEvent)notification;

        PropertySet propertySet = new PropertySet(ItemSchema.UniqueBody);
        propertySet.RequestedBodyType = BodyType.Text;
        propertySet.BasePropertySet = BasePropertySet.FirstClassProperties;

        // Parse Email
        EmailMessage message = EmailMessage.Bind(service, item.ItemId, propertySet);
        from = message.From.Address;
        subject = message.Subject;
        body = message.Body.Text;

        if (message.ToRecipients.Count > 0)
        {
            to = message.ToRecipients[0].Address;
            body += "\n TO FIELD";
        }
        else if (message.CcRecipients.Count > 0)
        {
            to = message.CcRecipients[0].Address;
            body += "\n CC FIELD";
        }
/************** Does not work! BccRecipients is always empty *****************/
        else if (message.BccRecipients.Count > 0)
        {
            to = message.BccRecipients[0].Address;
            body += "\n BCC FIELD";
        }

 /************* REST OF CODE ************************/
    }
}

Solution

  • That would kind of defeat the point of a blind-carbon-copy. I dont believe it can be done.