Flag all items in conversation

Y

Yaz

I am a newbie to the Outlook object model, and have also not developed /
written code in a long time, so I am getting quite frustrated when I am not
finding what I need from the object browser, or sample code on the web.
Especially since what I am trying to is so simple, it should not take too
long to do:

I would like to flag all items in a conversation (thread) to get flagged as
'completed' when I flag one item in the thread as complete. So, I thought
I'd write a macro that takes the current item, finds all items in the
conversation and flags them all as complete.

The MailItem object does not offer an easy way to do this, and I don't know
how to use the Items object to find the related emails .

Please help.

- Yasmeen
 
M

Michael Bauer

Hi Yasmeen,

this little sample expects there´s one MailItem selected, takes its
ConversationTopic´s value, searches for all the same conversation items
in the same folder, and flags and saves them.

Public Sub FlagConversationTopic()
Dim oMail As Outlook.MailItem
Dim oItems As Outlook.Items

With Application.ActiveExplorer
Set oMail = .Selection(1)
Set oItems = .CurrentFolder.Items.Restrict("[ConversationTopic]='" _
& oMail.ConversationTopic & "'")
End With

For Each oMail In oItems
oMail.FlagStatus = olFlagComplete
oMail.Save
Next
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top