我正在使用EWS在收件箱中创建StreamingSubscription
。它正在侦听NewMail
事件。我能够从发送地址,主题,正文,地址,CC地址但不是BCC地址。有没有办法看到这个清单?
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 ************************/
}
}
答案 0 :(得分:1)
这有点打败盲目抄袭的重点。我不相信它可以做到。
答案 1 :(得分:0)
考虑使用Exchange的日记功能。这使用称为“信封日记”的内容,其中包含Exchange环境中邮件的BCC信息。
对于来自外部来源(gmail)的所有内容,没有可用的BCC信息。
答案 2 :(得分:0)