Outlook 出局。删除电子邮件

Outlook 出局。删除电子邮件,outlook,Outlook,当我的系统禁用自动存档时,是否有办法每天在设定的时间删除文件夹中的所有电子邮件?通常我会使用自动存档来解决这个问题,但目前它不是一个选项 设置每日重复性任务,包括提醒和唯一主题 在ThisOutlookSession模块中 Option Explicit Private Sub Application_Reminder(ByVal Item As Object) If Item.MessageClass = "IPM.Task" Then If Item.Subje

当我的系统禁用自动存档时,是否有办法每天在设定的时间删除文件夹中的所有电子邮件?通常我会使用自动存档来解决这个问题,但目前它不是一个选项

设置每日重复性任务,包括提醒和唯一主题

在ThisOutlookSession模块中

Option Explicit

Private Sub Application_Reminder(ByVal Item As Object)

    If Item.MessageClass = "IPM.Task" Then

        If Item.Subject = "Scheduled Deletion" Then
            DeleteFromToBeDeleted
        End If

    End If

End Sub


Sub DeleteFromToBeDeleted()

    Dim myFolder As Folder
    Dim i As Long

    Set myFolder = Application.GetNamespace("MAPI"). _
            GetDefaultFolder(olFolderInbox).Folders("ToBeDeleted")

    For i = myFolder.items.Count To 1 Step -1
        myFolder.items(i).Delete
    Next i

    Set myFolder = Nothing

End Sub