Platform SDK: CDO 1.2.1 |
The Add method creates and returns a new Message object in the Messages collection.
Set objMessage = collMessages.Add( [subject] [, text] [, importance] )
The subject, text, and importance parameters correspond to the Subject, Text, and Importance properties on the Message object.
You must create all new messages in the Outbox folder.
Only C/C++ and Java programs can use an IStream object for the text parameter. They should pass an IUnknown object that returns an IStream interface in response to QueryInterface. Microsoft® Visual Basic® supports the IDispatch interface and not IUnknown, so it cannot use an IStream object.
This code fragment replies to an original message:
' from the sample function Util_ReplyToConversation Set objOutbox = objSession.GetDefaultFolder(CdoDefaultFolderOutbox) Set objNewMsg = objOutbox.Messages.Add ' verify objNewMsg created successfully ... then supply properties Set objSenderAE = objOriginalMsg.Sender ' sender as AddressEntry With objNewMsg .Text = "Here is a reply to your message." ' new text .Subject = objOriginalMsg.Subject ' copy original properties Set objRecip = .Recipients.Add(name:=objsenderAE.Name, _ type:=CdoTo, _ address:=objSenderAE.Type & ":" & objSenderAE.Address) ' ** the preceding line is not strictly necessary with CDO for NTS, ' ** but it allows this code to run with CDO for Exchange, where ' ** Recipient.Address requires a FULL address concatenated from ' ** AddressEntry.Type, ":", and AddressEntry.Address .Send End With