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:36
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:41:39
Don't know the first thing about this, but might you need something like:

For iii = 1 to myFolder.Items.Count
myFolder.Items(iii).delete()
Next iii

Kristen
Go to Top of Page

Xerxes
Aged Yak Warrior

666 Posts

Posted - 2005-09-01 : 14:35:25
Is he asking for a cursor?

Semper fi,
XERXES, USMC(Ret.)
------------------------------------------------------
The Marine Corps taught me everything but SQL!
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2005-09-01 : 15:21:19
Can't be. Questions about Cursors aren't allowed on SQL Team

Kristen
Go to Top of Page

Xerxes
Aged Yak Warrior

666 Posts

Posted - 2005-09-01 : 15:30:36
Kristen.....you are just TOO COOL!

Semper fi,
XERXES, USMC(Ret.)
------------------------------------------------------
The Marine Corps taught me everything but SQL!
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-09-02 : 01:46:15
>>Is he asking for a cursor?

Cursors in Client side

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -