2

我正在使用 EWSStreamingSubscription在收件箱上创建一个。它正在监听NewMail事件。我可以提取发件人地址、主题、正文、收件人地址、抄送地址,但不能提取密件抄送地址。有什么办法可以看到这个列表吗?

代码:

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 ************************/
    }
}
4

3 回答 3

1

这有点违背盲抄本的意义。我不相信它可以做到。

于 2012-03-26T16:37:04.860 回答
0

考虑使用 Exchange 的日记功能。这使用称为“信封日记”的东西,其中包括 Exchange 环境中邮件的密件抄送信息。

对于来自外部来源 (gmail) 的所有内容,没有密件抄送信息可用。

于 2012-03-26T16:42:35.720 回答
0

这可能会有所帮助: http: //gsexdev.blogspot.com/2011/06/processing-bccs-in-exchange-transport.html

于 2012-05-24T08:15:33.930 回答