Finding messages by conversation macro

  • Thread starter Thread starter Nagua
  • Start date Start date
N

Nagua

I am familiar with some VBA macro writing in Word but no nothing for how to
do this in Outlook. I am trying to accomplish the following:

Find all email messages, by conversation, after I reply to a message with a
certain phrase and move it to Folder named Completed Work.

I attempted to run a rule, but I need to run a script within the rule to
complete the "find messages by conversation" part.

Can this be accomplished and how?

Thanks!
 
You would use a Find or Restrict on the Items collection of each folder
where you wanted to find those related items. The property to filter on is
the ConversationTopic property.

How you get a folder reference for something like Completed Work depends on
where it's located in the folder tree. Let's say the filter is just for
Inbox, code would look something like this:

Sub GetConversationItems(Item As MailItem)
Dim oFolder As Outlook.MAPIFolder
Dim colItems As Outlook.Items
Dim colFiltered As Outlook.Items

Set oFolder = Application.Session.GetDefaultFolder(olFolderInbox)
Set colItems = oFolder.Items
Set colFiltered = colItems.Restrict("[ConversationTopic]='" &
Item.ConversationTopic & "'")

' now you have the items in that conversation, do something with them
End Sub
 
Hi Ken,

Can you please let me know how I can display colFiltered. I actually want to display it in the exact same fashion as we get when we filter a conversation or when we find related mail the way we see filtered mail in Inbox. Can you please paste the code for the diplay part.

Thanks
Max
 
Back
Top