Set all mail items in a conversation to read using VBA
<p>I have code that archives entire conversations. This works for selecting a single mail item in the conversation as well as selecting the conversation header.</p>
<p>I'd like to add the ability to mark all messages within the conversation as read.</p>
<p>Here's the existing code:</p>
<pre><code>Sub Archive()
    Set ArchiveFolder = Application.GetNamespace(&quot;MAPI&quot;).GetDefaultFolder(olFolderInbox).Parent.Folders(&quot;Archive&quot;)
    If ArchiveFolder Is Nothing Then
          Set ArchiveFolder = Application.GetNamespace(&quot;MAPI&quot;).GetDefaultFolder(olFolderInbox).Parent.Folders.Add(&quot;Archive&quot;)
    End If
    Set oStore = ArchiveFolder.Store
    Set selections = ActiveExplorer.Selection
    If selections.Count &lt;&gt; 0 Then
        ' Mail item selected
        For Each theSelection In selections
            Set oConv = theSelection.GetConversation
            If Not (oConv Is Nothing) Then
                 oConv.SetAlwaysMoveToFolder ArchiveFolder, oStore
                 oConv.StopAlwaysMoveToFolder oStore
            End If
        Next theSelection
    Else
        ' Conversation header selected
        Set oConv = ActiveExplorer.Selection.GetSelection(Outlook.OlSelectionContents.olConversationHeaders).Item(1).GetConversation
        If Not (oConv Is Nothing) Then
            oConv.SetAlwaysMoveToFolder ArchiveFolder, oStore
            oConv.StopAlwaysMoveToFolder oStore
        End If
    End If
End Sub
</code></pre>