Is there a way to determine if an email is a reply / reply using ews C #?

I am writing a support system, and this is my first time using EWS. So far, I have been quite successful. I can extract the information I need. Submit emaisl and everything works fine. I have a slight headache. Is there a way to tell if the letter is really the answer? The main idea of ​​the application is someone sends an email. We respond and give them the reference number. This is done and works great. Now, if they respond to the same address, we need to write it a little differently in our database. so i need a magical way to find out if the email is the answer. So far, I'm stuck.

Any suggestions would be greatly appreciated as I am new to the programming industry and so far googling has not brought anything useful. Here I include a section of code

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); } } 
+8
c # exchangewebservices
source share
2 answers

Ok So from the comments. There seems to be no final path. User comments helped me get this answer and close this thread. I change my mind and posted it here. So first. Thanks for all your answers.

The easiest way is to include a good reference number in your object. For example, "Supp-1234"

Now in the code we can check this reference number in the header. If he is. This is most likely the answer. Testing for RE is also an option, but somewhat less effective. A bummer is that customers can remove the / RE reference number from the topic header. For those guys. Poor you, your problem will not be registered. or you know. do whatever. :)

Thanks again to all the answers. You guys really helped me!

+1
source share

InReplyTo is a string value containing the identifier of the element for which this message is a response. If it is null, the message is not a response.

 var mailItem = myItem as EmailMessage; if (mailItem.InReplyTo != null) { // this is a reply message . . . } 

Additional Information: MSDN InReplyTo

+5
source share

All Articles