c# - Exchange EWS 获取 BCC 收件人

标签 c# exchangewebservices bcc

我正在使用 EWS 在收件箱上创建一个 StreamingSubscription。它正在监听 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 ************************/
    }
}

最佳答案

这有点违背了盲目抄送的目的。我不相信这是可以做到的。

关于c# - Exchange EWS 获取 BCC 收件人,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9875247/

相关文章:

c# - 在运行时更新 app.config system.net 设置

python - 使用 exchangelib 按收件人地址过滤 EWS 邮箱

php - 即使 cc 和 bcc 为空,Laravel 邮件也会发送

带有收件人、抄送和密件抄送的 Java 邮件

c# - 如何将 C# 库添加到 Monaco 编辑器(代码完成)并限制可能的库?

c# - 仅当重新加载页面时,ObservableCollection 元素上的绑定(bind)才会更改

exchangewebservices - 访问被拒绝。检查凭据并重试 - 偶尔发生

Java EWS findappointments 日期表现得很奇怪,要么返回很多,要么什么也没有

c# - 使用 MailMessage 类发送邮件 - BCC 和 CC 计数的限制?

c# - 如何将 switch case 操作放入 C# 的循环中?