Platform SDK: CDO 1.2.1 |
The Recipients property returns a single Recipient object or a Recipients collection object. Read-only.
Set collRecips = objMessage.Recipients Set objRecip = objMessage.Recipients(index)
Object (Recipient or Recipients collection)
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.
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