我正在编写一个支持系统,这是我第一次使用 EWS。到目前为止,我已经相当成功了。我可以提取我需要的信息。发送电子邮件,一切正常。我确实有点头疼。有没有办法判断电子邮件是否实际上是回复?该应用程序的基本思想是有人发送电子邮件。我们回复并给他们一个参考号。这已经完成并且工作得很好。现在,如果他们回复同一个地址,我们需要在数据库中记录一些不同的信息。因此我需要一些神奇的方法来判断电子邮件是否是回复。到目前为止我被困住了。
任何建议将不胜感激,因为我是编程行业的新手,到目前为止,谷歌搜索没有发现任何有用的东西。我在这里包含一段代码
FindItemsResults<Item> findResults = service.FindItems(WellKnownFolderName.Inbox, view);
foreach (Item myItem in findResults.Items.Where(i => i is EmailMessage))
{
var mailItem = myItem as EmailMessage;
if (!mailItem.IsRead)
{
// load primary properties and get a text body type
mailItem.Load(propertySet);
// Update the item to isRead in email
mailItem.IsRead = true;
mailItem.Update(ConflictResolutionMode.AutoResolve);
//Check if it is a reply and mark the msg as such
// add message to list
SupportEmailMessage msg = new SupportEmailMessage();
msg.Subject = mailItem.Subject;
msg.MessageBody = mailItem.Body.Text;
msg.DateSent = mailItem.DateTimeSent;
msg.Sender = mailItem.Sender.Address;
toReturnList.Add(msg);
}
}
回复中是一个字符串值,其中包含此消息所回复的项目的标识符。如果为空,则该消息不是回复。
var mailItem = myItem as EmailMessage;
if (mailItem.InReplyTo != null)
{
// this is a reply message
.
.
.
}
更多信息:MSDN 回复 https://msdn.microsoft.com/en-us/library/exchangewebservices.itemtype.inreplyto(v=exchg.150).aspx
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)