How to use vbscritp to add a folder to the root folder which is "personal folders"

M

Microsoft

Hi all,

I can use vbscript to add a folder to the subfolders such as "contacts"
subfolder in the example.

Set myOlApp = CreateObject("Outlook.Application")
Set myNameSpace = myOlApp.GetNameSpace("MAPI")
Set myFolder = myNamespace.GetDefaultFolder(10)
Set myNewFolder = myFolder.Folders.Add("myContacts",10)

But i can't find the defination for the root folder..


OlDefaultFolders

olFolderDeletedItems = 3

olFolderOutbox = 4

olFolderSentMail = 5

olFolderInbox = 6

olFolderCalendar = 9

olFolderContacts = 10

olFolderJournal = 11

olFolderNotes = 12

olFolderTasks = 13

olFolderDrafts = 16

olPublicFoldersAllPublicFolders = 18
 
S

Sue Mosher [MVP-Outlook]

It's the Parent of the user's default folders:

Set myRoot = myFolder.Parent
Set myNewFolder = myRoot.Folders.Add("myContacts",10)
 
W

Wolfram Jahn

Sue said:
It's the Parent of the user's default folders:

Set myRoot = myFolder.Parent
Set myNewFolder = myRoot.Folders.Add("myContacts",10)
Isn't that the namespace object itself, which has a folders collection?

Wolfram
 
S

Sue Mosher [MVP-Outlook]

No, but you're close. Each MAPIFolder in Namespace.Folders is the root of one information store.

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 

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