2 Methods to Batch Delete All Outlook Emails in a Conversation

If you want to bulk delete all the emails in a conversation, you can use the methods introduced in this article.

Sometimes, when deleting an email, you may also want to delete all of its related emails, namely the other emails in the same conversation. Generally, if you’re a novice in Outlook, you can use Method 1, searching all emails in the conversation and then deleting them. Of course, if you feel it a bit troublesome, you can use a piece of VBA code, which has been exposed elaborately in the Method 2.Batch Delete All Outlook Emails in a Conversation

Method 1: Delete All Found Emails in a Conversation Manually

  1. At first, select and right click on an email in a conversation that you want to delete.
  2. Then, choose “Find Related” > “Messages in This Conversation” from context menu.Find Messages in This Conversation
  3. Next, a list of search results will be shown.
  4. Subsequently, you need to select the proper emails in this conversation. Since at times Outlook may include the wrong emails in search results, you had better check the emails before selecting and deleting.
  5. Finally, you can press “Delete” button to delete all the selected emails.Delete All Selected Found Emails

Method 2: Batch Delete All Emails in a Conversation via VBA

  1. For a start, press “Alt + F11” to access VBA editor in Outlook.
  2. Then, put the following VBA code into a project or module.
Dim strConversationID As String

Sub DeleteItemsInConversation()
    Dim objSourceItem As Object
    Dim objConversation As Conversation
    Dim objItem As Object

    Set objSourceItem = ActiveExplorer.Selection.Item(1)
    Set objConversation = objSourceItem.GetConversation
    strConversationID = objConversation.ConversationID
 
    If Not (objConversation Is Nothing) Then
       'Mark each item with conversation ID
       For Each objItem In objConversation.GetRootItems
           objItem.UserProperties.Add strConversationID, olText
           objItem.Save
           Call ProcessChildren(objItem, objConversation)
       Next
    End If
 
    Call DeleteItemsInThisConversation
 
    MsgBox "Complete!", vbExclamation
End Sub

Sub ProcessChildren(objCurItem As Object, objConversation As Conversation)
    Dim objItems As SimpleItems
    Dim objItem As Object
 
    Set objItems = objConversation.GetChildren(objCurItem)

    If objItems.Count > 0 Then
       For Each objItem In objItems
           objItem.UserProperties.Add strConversationID, olText
           objItem.Save
           'Process all children recursively
           Call ProcessChildren(objItem, objConversation)
       Next
    End If
End Sub

Sub DeleteItemsInThisConversation()
    Dim objStore As Outlook.Store
    Dim objFolder As Outlook.Folder
 
    'Change "Norwood Ada" to ==>
    'Display name of the Outlook file where the current conversation is
    Set objStore = Application.Session.Stores.Item("Norwood Ada")
 
    For Each objFolder In objStore.GetRootFolder.Folders
        If objFolder.DefaultItemType = olMailItem Then
           Call ProcessFolders(objFolder)
        End If
    Next
End Sub

Sub ProcessFolders(ByVal objCurFolder As Folder)
    Dim objItem As Object
    Dim objSubfolder As Folder
 
    For Each objItem In objCurFolder.Items
        If TypeName(objItem.UserProperties.Find(strConversationID)) <> "Nothing" Then
           objItem.Delete
        End If
    Next
 
    If objCurFolder.Folders.Count > 0 Then
       For Each objSubfolder In objCurFolder.Folders
           Call ProcessFolders(objSubfolder)
       Next
    End If
End Sub

VBA Code - Put Code into a Module

  1. Afterwards, add “DeleteItemsInConversation” macro to Quick Access Toolbar according to “How to Run VBA Code in Your Outlook“.
  2. Eventually, you can take a shot.
  • First off, select an email in the conversation
  • Then, hit macro button in Quick Access Toolbar.Run Macro on Selected Email
  • When you get a “Completed” message, all the email in this conversation have been deleted.Deleted Emails

Don’t Bypass Outlook Errors

Almost each Outlook user has encountered various errors in Outlook. Some users tend to overlook them if the Outlook file still can be accessible. However, in fact, it is necessary to resolve them as soon as possible. Otherwise, more serious issues may take place as well. Fortunately, Outlook offers an inbuilt tool – Scanpst. Thus, users can use it to repair PST problems. If it fails, you can continue resorting to a more powerful external tool, such as DataNumen Outlook Repair.

Author Introduction:

Shirley Zhang is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including sql fix and outlook repair software products. For more information visit www.datanumen.com

Comments are closed.