Folders.Add Method
Outlook Developer Reference |
Creates a new folder in the Folders collection.
Syntax
expression.Add(Name, Type)
expression A variable that represents a Folders object.
Parameters
Name | Required/Optional | Data Type | Description |
---|---|---|---|
Name | Required | String | The display name for the new folder. |
Type | Optional | Long | The Outlook folder type for the new folder. If the folder type is not specified, the new folder will default to the same type as the folder in which it is created. Can be one of the following OlDefaultFolders constants: olFolderCalendar, olFolderContacts, olFolderDrafts, olFolderInbox, olFolderJournal, olFolderNotes, or olFolderTasks. The constants olFolderConflicts, olFolderDeletedItems, olFolderJunk, olFolderLocalFailures, olFolderManagedEmail, olFolderOutbox, olFolderRssSubscriptions, olFolderSentMail, olFolderServerFailures, olFolderSyncIssues, olFolderToDo, and olPublicFoldersAllPublicFolders cannot be specified for this argument. |
Return Value
A Folder object that represents the new folder.
Example
This VBA example uses the Add method to add the new folder named "My Contacts" to the current (default) Contacts folder.
Visual Basic for Applications |
---|
|
This VBA example uses the Add method to add three new folders in the Tasks folder. The first folder, "Notes Folder", will contain note items. The second folder, "Contacts Folder", will contain contact items. The third folder, “Public Folder” will be a public folder. If the folders already exist, a message box will inform the user.
Visual Basic for Applications |
---|
|
See Also