deleting emails

  • Thread starter Thread starter hb21l6
  • Start date Start date
H

hb21l6

How can I delete all the emails in the SPAM folder?
The folders called "SPAMfighter"

The folder layout is like this ,
- MyEmails (profile name)
- deleted items (3)
- drafts
- Inbox (6)
-other folder
- Outbox (4)
- sent Items (5)
- SpamFighter
- Calendar (9)

I know I can access most of these folders using the getdefaultFolder()
method and changing the ID.

Set myNamespace = Application.GetNamespace("MAPI")
Set mFolder = objNS.GetDefaultFolder(5)



Using this loop, i still can't find the folder ID called SPAMfighter.?

Sub ListFolders()

Set myNamespace = Application.GetNamespace("MAPI")
'Set myFolder = myNamespace.GetDefaultFolder(olFolderInbox)
On Error Resume Next
For i = 0 To 50
Set mFolder = myNamespace.GetDefaultFolder(i)
MsgBox mFolder.Name & " _ " & i
Next

End Sub

any idea how i can find it?

cheers
Dave
 
ahh, no worries, i've sorted it.. found a nice little sample :O)


Set inbox = Application.Session.GetDefaultFolder(olFolderInbox)
Set Root = inbox.Parent
Set myFolder = Root.Folders("SPAMfighter")

If myFolder.Name = "SPAMfighter" Then
For Each Item In myFolder.Items
Item.Delete
Next
End If

End Sub
 
Back
Top