This sounds possible. The SyncObjects collection contains your defined
Send/Receive groups, and SyncObject exposes a SyncEnd event that has the
perfect spot to fire code to purge the current folder's contents.
This code will get you the appropriate SyncObject (make sure to include Dim
WithEvents objSO As Outlook.SyncObject in the module)
Sub GetSyncObject()
Dim objNS As Outlook.NameSpace
Dim objSOs As Outlook.SyncObjects
Set objNS = Application.GetNamespace("MAPI")
Set objSOs = objNS.SyncObjects
Set objSO = objSOs.Item("mvps.org")
End Sub
Private Sub objSO_SyncEnd()
Dim objCB As Office.CommandBarButton
'Get the Purge Deleted Items commandbar button
Set objCB = Application.ActiveExplorer.CommandBars.FindControl(, "5583")
objCB.Execute 'PURGE THE FOLDER
'WHAT HAPPENS IF THIS ISN'T AN IMAP FOLDER? <shrug>
End Sub
You'll have to test it and tweak it, but this *should* work. You'll have to
run GetSyncObject when Outlook starts in order to always have access to the
objSO_SyncEnd event, add garbage collection, etc.