Am Wed, 8 Feb 2006 11:30:19 -0800 schrieb Frank M.:
Frank, I never worked with IMAP but suppose this would work. For getting the
folder you could create a VBA method in ThisOutlookSession:
Public Sub Test()
With Application.Session.Pickfolder
Debug.Print "EntryID: " & .EntryID
Debug.Print "StoreID: " & .StoreID
End With
End Sub
Place the cursor into the method and press F5, then select the IMAP Inbox.
Open now the Direct Window (ctrl+g). It contains the folder´s IDs now.
The above method you can delete now and write the following code into
ThisOutlookSession instead:
Private Const IMAP_ENTRYID As String = "place the EntryID from the Direct
Window here"
Private Const IMAP_STOREID As String = "place the StoreID from the Direct
Window here"
Private Const DEL_BUTTON As Long = 0 ' Enter the Button´s ID here
Public Sub DeleteIMAP()
Dim oFld as Outlook.MapiFolder
Dim oCmd as Office.CommandBarButton
Set oFld = Application.Session _
.GetFolderFromID(IMAP_ENTRYID, IMAP_STOREID)
Set Application.ActiveExplorer.CurrentFolder = oFld
Set oCmd = Application.ActiveExplorer_
.CommandBars.FindControl(,DEL_BUTTON)
oCmd.Execute
End Sub
The only thing left for you is to get the Button´s ID (const DEL_BUTTON).
You could download OutlookSpy (www.dimastr.com) and search for the ID
comfortably.
--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
--
www.vbOffice.net --
> I have searched throughout the forums to find out how to automatically
purge
> deleted messages in an IMAP account but only found a lot of talk of how
> Microsoft has not made that option part of Outlook.
>
> I have created three rules (in succession) that first copy the mail from
> the IMAP INBOX to the PERSONAL FOLDERS INBOX (so my PDA can see it), then
> copy the message to my IMAP DELETED FOLDER (so I have a copy to look back
on
> if necessary) and then to permanently DELETE it. This however does not
remove
> it from my IMAP server INBOX unless I click on PURGE DELETED MESSAGES.
>
> I see there are options in MAIL RULES to either: RUN SCRIPT or PERFORM
> CUSTOM ACTION. Unfortunately, when I searched HELP ONLINE there is very
> little about either of these (well, there is a lot on using VB Scripting,
but
> that is beyond my capabilities / no good examples). If OUTLOOK had a MACRO
> CREATOR (like EXCEL), I could probably do it, but I do not see that
option.
>
> Has any one written a script or custom action that could be used? In
> essence, all it needs to do is select the INBOX folder of the IMAP account
> and do a 'click' on the PURGE MESSAGES icon. Anyone who wrote such a
script
> (or Custom Action) would get a LOT of thanks from dozens of people who
have
> the same need as me.
>
> Anyone know how to do it?
>
> Thanks.
>
> Frank in Michigan