empty deleted items after x days

J

J. Sperry

I'm using Outlook 2007. I'd like the deleted items folder to 'selectively'
empty when I exit. On another system, I got used to a Groupwise feature that
would empty the deleted items that were older than so many days (user-defined
number). It's like a FIFO (first-in-first-out) trash can instead of an
empty-everything-all-at-once trash can.

My office has a separate archiving system (which I have issues with), so I
can't use Outlook's archive features, but I could use a macro.
 
J

J. Sperry

I can't "fix" it, whatever that means. It has been disabled by our IT
department, in order to use a different archiving program, Symantec's
Enterprise Vault. Assuming it was possible to do something in EV as
described below, I can't because it's basically set up as a read-only archive.
 
J

J. Sperry

OK, I looked for a solution on my own, and I think I found one from David
Bistry at http://www.outlookcode.com/codedetail.aspx?id=502. I modified the
code a little (removing stuff I don't need), and call it from
Application_Startup.

Sub DeleteDelete()

Dim myOlApp, myNameSpace As Object
Dim MyItem As Object
Dim DeletedFolder As Object

Set myOlApp = CreateObject("Outlook.Application")
Set myNameSpace = myOlApp.GetNamespace("MAPI")
Set DeletedFolder = myNameSpace.GetDefaultFolder(olFolderDeletedItems)

For Each MyItem In DeletedFolder.Items
If DateDiff("d", MyItem.ReceivedTime, Now) > 100 Then
MyItem.Delete
End If
Next
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top