Purge deleted messages from IMAP server MS Outlook

  • Thread starter Thread starter Sitchensis
  • Start date Start date
S

Sitchensis

Hi all,

I have used this code (below) to emulate programatically a user
clicking on the Purge Deleted Messages button in microsoft outlook to
remove completely deleted messages from an imap server (just deleting
will not work for POP3 or IMAP served mail). However, I then get the
confirmation dialog asking me whether I'm sure I want to delete same
messages.

Sub PurgeMessages()

Dim myBar As CommandBar
Set myBar = Application.ActiveExplorer.CommandBars("Menu Bar")
Dim myButtonPopup As CommandBarPopup
Set myButtonPopup = myBar.Controls("Edit")
Dim myButton As CommandBarButton
Set myButton = myButtonPopup.Controls("Purge Deleted Messages")
myButton.Execute

End Sub

I'd like to avoid the confirmation dialog, so is there any way to
emulate a return (yes confirmation) keystroke in the sub or must the
user always confirm yes in the dialog to delete the mail?

Any suggestions/workarounds? Thanks in advance for your time.
Sitchensis.
 
Hi all,

I figured this one out myself. To stop the confirm deletion dialog go
to outlook main toolbar select tools>options> select the "other" tab,
selected the "advanced" button then uncheck the "warn before before
permanently deleting items" checkbox. From looking through previous
posts this issue seemed to be wrecking the heads of a few bods.. The
code in the above posting can then be used to automate your imap
deletions...

All the best Sitchensis...
 
Back
Top