Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 extremely easy

Author  Topic 

notsosuper
Posting Yak Master

190 Posts

Posted - 2005-09-01 : 12:50:39
I need some sort of loop that it won't only delete first item but all the items inside the folder. Please help, I am gone blank can't even write a loop here

Sub Deleteall()
Dim oapp As Outlook.Application
Dim myNameSpace As Outlook.NameSpace
Dim myFolder As Outlook.MAPIFolder
oapp = CreateObject("Outlook.Application")
myNameSpace = oapp.GetNamespace("MAPI")
myFolder = myNameSpace.Folders("Public Folders").Folders("All Public Folders").Folders("Contacts")
On Error GoTo ErrorHandler

myFolder.Items(1).delete()

Exit Sub
ErrorHandler:
MsgBox("There are no items to delete.")
End Sub

Kristen
Test

22859 Posts

Posted - 2005-09-01 : 13:40:12
Duplicate of http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=54686
Go to Top of Page
   

- Advertisement -