Add Method (Items Object)

Applies To

Items collection object.

Description

Creates a new Outlook item in the Items collection for the folder, and returns the new item. If not specified, the type of the item defaults to the type of the folder, or to MailItem if the parent folder is not typed.

Syntax

expression.Add(Type)

expression An expression that returns an Items object.

Type Optional Variant. The Outlook item type for the new item. Can be one of the following OlItems constants: olAppointmentItem, olContactItem, olJournalItem, olMailItem, olNoteItem, olPostItem, or olTaskItem or any valid message class. Specify the message class to create customs forms.

Example

This example gets the current Contacts folder and adds a new ContactItem object to it.

Set myFolder = _
    olNamespace.GetDefaultFolder(olFolderContacts)
Set myItem = myFolder.Items.Add
This example adds a custom form to the default Tasks folder.

Set myFolder = _
    olNamespace.GetDefaultFolder(olFolderTasks)
Set myItems = myFolder.Items
Set myItem = myItems.Add("IPM.Task.myTask")