I created a rule that moves emails that contains a specific word in body to another folder.
It applies whenever that word is in body of older emails down the thread (when you scroll down to older emails that were replied to).
I need it to identify that word within the most recent email body only (and disregard the rest of the thread).
Outlook doesn't distinguish old email bodies and new ones. The message body is a single string. The best what you can do is to compare the message body of two items from the same conversation and extract the newer part. So, following that you will be able to recognize whether a keyword is a part of the newer message or not. The GetConversation method obtains a
Conversationobject that represents the conversation to which this item belongs. A conversation represents one or more items in one or more folders and stores.Use the
Find/FindNextorRestrictmethods of theItemsclass to find items that correspond to the specified condition. Read more about them with code examples in the following articles:Also you may find the AdvancedSearch method of the Application class helpful. The key benefits of using the
AdvancedSearchmethod in Outlook are:AdvancedSearchmethod runs it automatically in the background.Find/FindNextmethods can be applied to a particularItemscollection (see theItemsproperty of theFolderclass in Outlook).IsInstantSearchEnabledproperty of theStoreclass).Stopmethod of theSearchclass.Read more about that in the Advanced search in Outlook programmatically: C#, VB.NET article.