gpt4 book ai didi

c# - EWS 只读取我的收件箱

转载 作者:行者123 更新时间:2023-11-30 14:10:50 25 4
gpt4 key购买 nike

<分区>

我正在尝试阅读特定的电子邮件帐户,以查找带有未读附件且主题中包含特定词语的项目。

我有以下代码可以工作,但只读取我的收件箱不是我想检查的收件箱

static void Main(string[] args)
{
ServicePointManager.ServerCertificateValidationCallback=CertificateValidationCallBack;
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010_SP2);// .Exchange2007_SP1);

service.UseDefaultCredentials = true;
service.AutodiscoverUrl("bbtest@domainname.com"); //, RedirectionUrlValidationCallback); //bbtest@bocuk.local

ItemView view = new ItemView(1);

string querystring = "HasAttachments:true Kind:email";
//From:'Philip Livingstone' Subject:'ATTACHMENT TEST' Kind:email";

// Find the first email message in the Inbox that has attachments.
// This results in a FindItem operation call to EWS.
FindItemsResults<Item> results = service.FindItems(WellKnownFolderName.Inbox, querystring, view);

foreach (EmailMessage email in results)

if (email.IsRead == false) // && email.HasAttachments == true
{
System.Diagnostics.Debug.Write("Found attachemnt on msg with subject: " + email.Subject);

// Request all the attachments on the email message.
//This results in a GetItem operation call to EWS.
email.Load(new PropertySet(EmailMessageSchema.Attachments));

foreach (Attachment attachment in email.Attachments)
{
if (attachment is FileAttachment)
...

我必须更改什么才能让我的代码读取 bbtest@domainname.com 收件箱中的消息?

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com