T
Tom
I have the following code sample in ThisOutLookSession and when I set a
breakpoint and step through the code, it does show the correct number of
items in Deleted Items folder - but does not delete them, no errors either
Sub CustomMailMessageRule (Item as Mailitem)
' at the very end of it, this is called
Call DeleteAllMailNotReceivedToday
End Sub
Sub DeleteAllMailNotReceivedToday()
Dim DL as outlook.items
Dim Om as Mailitem
Dim i as integer
set DL =
application.getnamespace("MAPI").getdefaultfolder(olfolderdeleteditems).items
for i = DL.Count to 1 step -1
set Om = DL.Item(i)
if datediff("h",Om.receivedtime, now()) > 24 then Om.Delete
next
set DL = nothing
set Om = nothing
End Sub
breakpoint and step through the code, it does show the correct number of
items in Deleted Items folder - but does not delete them, no errors either
Sub CustomMailMessageRule (Item as Mailitem)
' at the very end of it, this is called
Call DeleteAllMailNotReceivedToday
End Sub
Sub DeleteAllMailNotReceivedToday()
Dim DL as outlook.items
Dim Om as Mailitem
Dim i as integer
set DL =
application.getnamespace("MAPI").getdefaultfolder(olfolderdeleteditems).items
for i = DL.Count to 1 step -1
set Om = DL.Item(i)
if datediff("h",Om.receivedtime, now()) > 24 then Om.Delete
next
set DL = nothing
set Om = nothing
End Sub