How to Batch Delete All Items Except Emails in “Deleted Items” Folder in Outlook

In Outlook, “Deleted Items” contains not only deleted emails but also deleted tasks, appointment, contacts and other types of items. If you wish to batch delete all items except emails from this folder, you can use the method introduced in this article.

No matter when you delete an email, appointment, task, contact, note or journal, the item will be moved to the “Deleted Items” folder. This is why your “Deleted Items” folder is always stuffed with all kinds of items. In reality, for most users, they simply hope that there are emails only in the “Deleted Items” folder. Hence, they would like to bulk delete all items except emails from “Deleted Items” folder.

Batch Delete All Items Except Emails in "Deleted Items" Folder in Outlook

Without any doubts, it’s very considerably tedious to manually achieve that. Thus, in the followings, we will share a more intelligent way with you. It uses VBA code. As for how to use VBA, you can refer to “How to Run VBA Code in Your Outlook“.

Batch Delete All Items Except Emails in “Deleted Items” Folder

  1. At first, start your Outlook application.
  2. Then, press “Alt + F11” to launch Outlook VBA editor.
  3. Next, in the new window, copy the following VBA code into a module.
Sub DeleteItemsExceptEmailsInDeletedItems()
    Dim objStore As Outlook.Store
    Dim objFolder As Outlook.Folder
 
    'Process all "Deleted Items" folders in your Outlook
    For Each objStore In Application.Session.Stores
        For Each objFolder In objStore.GetRootFolder.Folders
            If objFolder.Name = "Deleted Items" Then
               Call ProcessDeletedItemsFolders(objFolder)
            End If
        Next
    Next
 
    MsgBox "Completed!", vbInformation + vbOKOnly
End Sub

Sub ProcessDeletedItemsFolders(objCurrentFolder As Outlook.Folder)
    Dim i As Long
    Dim objItem As Object
    Dim objSubfolder As Outlook.Folder
 
    'Delete all items except emails
    For i = objCurrentFolder.Items.Count To 1 Step -1
        If Not (TypeOf objCurrentFolder.Items(i) Is MailItem) Then
           Set objItem = objCurrentFolder.Items(i)
           objItem.Delete
        End If
    Next
 
    If objCurrentFolder.Folders.Count > 0 Then
       'Delete all subfolders except mail folders
       For Each objSubfolder In objCurrentFolder.Folders
           If objSubfolder.DefaultItemType <> olMailItem Then
              objSubfolder.Delete
           End If
        Next
    End If
End Sub

VBA Code - Batch Delete All Items Except Emails in "Deleted Items" Folders

  1. Subsequently, move cursor in the “DeleteItemsExceptEmailsInDeletedItems” subroutine.
  2. Finally, press “F5” key button.
  3. When macro finishes, you get the “Completed” prompt.
  4. Afterwards, you can check your “Deleted Items” folders. All the items except emails must have disappeared, like the following screenshot:All Items Except Emails Are Deleted

Don’t Bypass Any Outlook Errors

Since Outlook errors are common, you have to get some helpful tricks to resolve them as soon as possible. Otherwise, accumulating issues can straightly damage your Outlook data file seriously. At that time, you have to try Outlook recovery. It requires an experienced and superfine PST fix tool, such as DataNumen Outlook Repair. It can help you get back maximum PST data irrespective of how seriously your Outlook data file has been damaged.

Author Introduction:

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

 

Comments are closed.