Adding A Folder to a Public Folder

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
 
S

Sue Mosher [MVP]

Wrong value for the Type parameter. It should be olFolderContacts. (HINT:
The object browser is your friend.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top