Platform SDK: CDO 1.2.1

Recipients Property (CDONTS Message Object)

The Recipients property returns a single Recipient object or a Recipients collection object. Read-only.

Syntax

Set collRecips = objMessage.Recipients 
Set objRecip = objMessage.Recipients(index) 
 
collRecips
Object. A Recipients collection object.
objMessage
Object. The Message object.
objRecip
Object. A single Recipient object.
index
Long. Specifies the number of the recipient within the Recipients collection. Ranges from 1 to the value specified by the Recipients collection's Count property.

Data Type

Object (Recipient or Recipients collection)

Remarks

You can change individual Recipient objects within the Recipients collection, Add them to the collection, and Delete them from the collection.

The CDO for NTS Library does not permit any modifications to messages in the Inbox, other than deleting the entire message. Prohibited modifications include adding, deleting, or modifying any attachment; adding, deleting, or modifying any recipient; and modifying any message property, even one with read/write access.

Example

This code fragment uses a loop to create a copy of every valid recipient of the original message objMessage in the copy message objCopyItem. For each copied recipient, it also copies important properties from the original.

For i = 1 To objMessage.Recipients.Count Step 1 
   Set objRecip = objMessage.Recipients.Item(i) 
   If Not objRecip Is Nothing Then 
      Set objCopyRecip = objCopyItem.Recipients.Add 
      If objCopyRecip Is Nothing Then 
         MsgBox "Unable to create recipient in message copy" 
         Exit Function 
      End If 
      ' Now copy the most important properties 
      objCopyRecip.Address = objRecip.Address 
      objCopyRecip.Name = objRecip.Name 
      objCopyRecip.Type = objRecip.Type 
   End If 
Next i