i need to delete all Items and Subfolders older than 6 months in the Deleted Items Folder, but this script(below) doesn't work correctly.
-------------------------------------------
Code: Select all
F12::
#SingleInstance
olApp := ComObjCreate("Outlook.Application")
olNameSpace := olApp.GetNamespace("MAPI")
olDestFolder := olNameSpace.Folders("[email protected]").Folders("Deleted Items")
EnvAdd, Today, -182, Days
FormatTime, Timestring, %Today%, dd.MM.yyyy HH.mm.ss
;MsgBox %Timestring%
Loop, % olDestFolder.Items.Count
{
date := olDestFolder.Items(A_Index).CreationTime
if date < Timestring
{
olDestFolder.Items(A_Index).Delete
}
else
{
MsgBox, 64, Done, Scan completed
return
}
}