The Add method creates and returns a new AppointmentItem or Message object in the Messages collection.
Set objMessage = objMsgColl.Add( [subject] [, text] [, type] [, importance] )
Constant | Value | Description |
---|---|---|
CdoLow | 0 | Low importance |
CdoNormal | 1 | Normal importance (default) |
CdoHigh | 2 | High importance |
The method parameters correspond to the Subject, Text, Type, and Importance properties of the Message object.
Note If you are adding an AppointmentItem object to a calendar folder, you cannot use any of the parameters of the Add method. You can, however, set the values later by using the corresponding properties.
You should create new messages in the Inbox or Outbox folder, and new appointments in the calendar folder.
The user must have permission to Add or Delete a Message object. Most users have this permission in their mailbox and their Personal Folders.
The new Message object is saved in the MAPI system when you call its Update method.
This code fragment replies to an original message:
' from the sample function Util_ReplyToConversation
Set objNewMsg = objSession.Outbox.Messages.Add
' verify objNewMsg created successfully ... then supply properties
Set objSenderAE = objOriginalMsg.Sender ' sender as AddressEntry
With objNewMsg
.Text = "How about a slightly used bicycle?" ' new text
.Subject = objOriginalMsg.Subject ' copy original properties
.ConversationTopic = objOriginalMsg.ConversationTopic
' append time stamp; compatible with Microsoft Exchange client
Set objOneRecip = .Recipients.Add( _
Name:=objSenderAE.Name, _
Address:=objSenderAE.Type & ":" & objSenderAE.Address, _
Type:=CdoTo)
.Recipients.Resolve
.Update
.Send showDialog:=False
End With