如何设置 ExchangeService 的 ReponseMessage 的优先级
How to set priority of ExchangeService's ReponseMessage
我正在使用 Microsoft.Exchange.WebServices.Data.ExchangeService
查找特定电子邮件并回复全部。我知道使用 System.Net.Mail 的 MailMessage
,我可以设置 Priority
属性。我没有看到使用 ExchangeService
?
的等价物
var exchangeService = new ExchangeService(ExchangeVersion.Exchange2013_SP1);
exchangeService.Credentials = new WebCredentials("usr", "pw", "myDomain.com");
exchangeService.TraceEnabled = false;
exchangeService.AutodiscoverUrl($"{usr}@myDomain.com", AutodiscoverRedirectionUrlValidationCallback);
它找到一封电子邮件:
var filter = new SearchFilterCollection(LogicalOperator.And, new IsEqualTo(EmailMessageSchema.IsRead, false));
var results = exchangeService.FindItems(WellKnownFolderName.Inbox, filter, new ItemView(50));
var interesting = results.Items.FirstOrDefault(e => e.Subject == "interesting");
它创建一个回复所有电子邮件:
var response = interesting.CreateReply(true);
response.Body = "I'm important!";
response.Priority = MailPriority.High; // No such property?
response.SendAndSaveCopy();
做之前 var response = interesting.CreateReply(true);
像这样设置有趣变量的重要性
interesting.Importance = Importance.Low;
注意:如果 var interesting
不是 EmailMessage
则先施放。它可能是 Item
类型
当您致电 CreateReply()
时,重要性将转移到回复中。
我是这样测试的
var interesting = results.Items.FirstOrDefault();
var orignal = (EmailMessage)interesting;
orignal.Importance = Importance.Low; orignal.CreateReply(true);
orignal.Subject = "Low priority";
orignal.ToRecipients.Add("myemail@domain.com");
orignal.SendAndSaveCopy();
原始邮件优先级高,回复优先级低
我正在使用 Microsoft.Exchange.WebServices.Data.ExchangeService
查找特定电子邮件并回复全部。我知道使用 System.Net.Mail 的 MailMessage
,我可以设置 Priority
属性。我没有看到使用 ExchangeService
?
var exchangeService = new ExchangeService(ExchangeVersion.Exchange2013_SP1);
exchangeService.Credentials = new WebCredentials("usr", "pw", "myDomain.com");
exchangeService.TraceEnabled = false;
exchangeService.AutodiscoverUrl($"{usr}@myDomain.com", AutodiscoverRedirectionUrlValidationCallback);
它找到一封电子邮件:
var filter = new SearchFilterCollection(LogicalOperator.And, new IsEqualTo(EmailMessageSchema.IsRead, false));
var results = exchangeService.FindItems(WellKnownFolderName.Inbox, filter, new ItemView(50));
var interesting = results.Items.FirstOrDefault(e => e.Subject == "interesting");
它创建一个回复所有电子邮件:
var response = interesting.CreateReply(true);
response.Body = "I'm important!";
response.Priority = MailPriority.High; // No such property?
response.SendAndSaveCopy();
做之前 var response = interesting.CreateReply(true);
像这样设置有趣变量的重要性
interesting.Importance = Importance.Low;
注意:如果 var interesting
不是 EmailMessage
则先施放。它可能是 Item
当您致电 CreateReply()
时,重要性将转移到回复中。
我是这样测试的
var interesting = results.Items.FirstOrDefault();
var orignal = (EmailMessage)interesting;
orignal.Importance = Importance.Low; orignal.CreateReply(true);
orignal.Subject = "Low priority";
orignal.ToRecipients.Add("myemail@domain.com");
orignal.SendAndSaveCopy();
原始邮件优先级高,回复优先级低