我的公司使用云 Exchange 系统,当电子邮件在“已删除邮件”文件夹中 30 天后删除(我们使用 Outlook 2010 客户端)。我想要一个脚本,将所有电子邮件从“已删除邮件”文件夹移动到名为“垃圾箱”的第二个文件夹。我能够在线找到以下大部分脚本,但它对我不起作用,我不确定缺少/不正确的内容。任何帮助表示赞赏...
Sub MoveDeletedItems()
Dim oSource As Outlook.MAPIFolder
Dim oTarget As OutlookMAPIFolder
Dim oDummy As Object
Dim oToMove As Object
Dim colItems As Outlook.Items
Dim i As Long
Set oSource = Application.Session.GetDefaultFolder(olFolderDeletedItems)
Set oTarget = oSource.Folders.Folder("Trash")
Set colItems = oSource.Items
For i = colItems.Count To 1 Step -1
Set oToMove = colItems(i)
Set oDummy = oToMove.Move(oTarget)
Next
End Sub