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

  • Thread starter Thread starter Microsoft
  • Start date Start date
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
 
It's the Parent of the user's default folders:

Set myRoot = myFolder.Parent
Set myNewFolder = myRoot.Folders.Add("myContacts",10)
 
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
 
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
 
Back
Top