Adding A Folder to a Public Folder

  • Thread starter Thread starter peg
  • Start date Start date
P

peg

I'm creating an app that deletes all the contents of a public "contacts"
folder. I found that looping thru each contact & deleting them takes a lot
of time. I was gonna just delete the folder and then add the folder back
in, but i can't seem to get it to add a new folder.

Dim olApp As Outlook.Application
Dim olns As Outlook.NameSpace
Dim olCal As Outlook.MAPIFolder
Set olApp = GetObject(, "Outlook.Application")
Set olns = olApp.GetNamespace("MAPI")

Set MyFolder1 = olns.Folders("Public Folders")
Set MyFolder2 = MyFolder1.Folders("All Public Folders")
Set MyFolder3 = MyFolder2.Folders("CUSTOMER CONTACTS")
Set fldContacts = MyFolder3.Folders("Test")
fldContacts.Delete

But this next line bombs out..... anyone know what i'm doing wrong???

MyFolder3.Folders.Add "Test", olContactItem
 
Wrong value for the Type parameter. It should be olFolderContacts. (HINT:
The object browser is your friend.)
 
Back
Top