Platform SDK: CDO 1.2.1

Add Method (Folders Collection)

The Add method creates and returns a new Folder object in the Folders collection.

Syntax

Set objFolder = objFoldersColl.Add(name)

objFolder
On successful return, contains the new Folder object.
objFoldersColl
Required. The Folders collection object.
name
Required. String. The display name of the folder.

Remarks

The name parameter corresponds to the Name property of the Folder object.

The user must have permission to Add or Delete a Folder object. Most users have this permission only for their personal folders.

You do not need to call the Update method of the new Folder object when you Add it to the collection. However, when you set or change any of the folder's properties, you must call Update to save the changes in the MAPI system.

Example

This code fragment adds a new folder to a user's Inbox:

Dim myInbox As Folder 
Dim newFolder As Folder 
Dim objSess As MAPI.Session ' use early binding for efficiency 
Set objSess = CreateObject ("MAPI.Session") 
Set myInbox = objSess.Inbox 
' add new folder to Inbox 
Set newFolder = myInbox.Folders.Add "Personal Messages" 
' Update not needed until changes made