'MS Outlook 2016 - Macro VBA search by conversation not all flagged as done
Is there a way to create a search folder in Outlook, that returns only conversations where not all emails in the thread/conversation have been flagged as completed/done?
Possibly to search by the email conversation header? I want to see all emails from the conversation, no matter if some of them are marked as completed already.
The search should only omit conversations where all emails are flagged as completed.
Thanks! J
Solution 1:[1]
You can use the Application.AdvancedSearch method which performs a search based on a specified DAV Searching and Locating (DASL) search string. Admittedly, the Search
class allows you to save the results of searching in a search folder (actually, it doesn’t contain any items, only references to items from the scope folders). You just need to call the Save
method on the Search
object in the AdvanvedSearchComplete
event handler to create a search folder with results.
To get the conversation items you can use the GetConversation method which obtains a Conversation
object that represents the conversation to which this item belongs. So, you may find all items that were not flagged/done and then process each item by getting the conversation it belongs to.
Finally, to find the required search criteria you may take a look at the Filtering Items article. For example, you may consider using the MailItem.IsMarkedAsTask and MailItem.TaskCompletedDate properties in your query.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Eugene Astafiev |