How to Auto Delete All Sent Task Requests in Your Outlook

If you dislike keeping the sent task request in your Outlook, you can use the method introduced in this article. It is able to let Outlook automatically delete all sent task requests via VBA.

As we all know, the larger Outlook file, the more vulnerable it will be. So, in order to keep Outlook file in small size, you always need to regularly delete the old and needless items from your Outlook, such as the sent task requests. Perhaps you’ve felt that manually deleting the task requests after sending it is troublesome. Thus, you would hope to configure Outlook to auto delete the sent task requests. Even though Outlook doesn’t provide this feature, you still can accomplish it with a bit of scripting. Now, in the followings, we will teach you to get it step by step.

Auto Delete All Sent Task Requests

  1. At the very outset, launch Outlook VBA editor according to “How to Run VBA Code in Your Outlook“.
  2. Then, in the “Microsoft Visual Basic for Applications” window, copy and paste the following VBA code into the “ThisOutlookSession” project.
Public WithEvents objSentFolder As Outlook.Folder
Public WithEvents objSentItems As Outlook.Items

Private Sub Application_Startup()
    Set objSentFolder = Outlook.Application.Session.GetDefaultFolder(olFolderSentMail)
    Set objSentItems = objSentFolder.Items
End Sub

'When new item gets into "Sent Items" folder
Private Sub objSentItems_ItemAdd(ByVal Item As Object)
    Dim objTaskRequest As Outlook.TaskRequestItem
    Dim objDeletedItems As Outlook.Items
 
    If TypeOf Item Is TaskRequestItem Then
       Set objTaskRequest = Item
       'Delete the sent task request
       objTaskRequest.Delete
 
       'If want to Permanently delete it
       'Use the following line
       'Set objDeletedItems = Outlook.Application.Session.GetDefaultFolder(olFolderDeletedItems).Items
       'For Each objItem In objDeletedItems
            'If TypeOf objItem Is TaskRequestItem And Left(objItem.Subject, 13) = "Task Request:" Then
                'objItem.Delete
            'End If
       'Next
    End If
End Sub

VBA Code - Auto Delete All Sent Task Requests

  1. After that, click into the “Application_Startup” subroutine and press “F5” key.
  2. From now on, every time when you send out a task request, the task request will be deleted automatically.Auto Deleted Sent Task Requests

Manage Your Outlook Items

There must be a great number of items in your Outlook. In face of them, you had better delete or archive the old and useless items from your Outlook. Otherwise, over time, your Outlook file will be oversized. Then, the file will be more prone to corruption. If your Outlook file is corrupted, you can first try the inbox repair tool to fix Outlook file. Nevertheless, most of time, the inbuilt utility is incompetent to undertake this task. Thus, you have no choice but to take recourse to make use of a powerful third party 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 mdf recovery and outlook repair software products. For more information visit www.datanumen.com

Comments are closed.