RDORecipients object collection

 

RDORecipients collection represents the recipients of a message.

Returned by:

RDOMail.Recipients, ReplyRecipients

RDOAddressBook.ShowAddressBook

 

The example below connects to the MAPI session used by Outlook, retrieves a message using the entry id of a give Outlook Object Model message, and prints out all the recipient names.

set Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
set Mail = Session.GetMessageFromID(MailItem.EntryID)
for each Recip in Mail.Recipients
  debug.print Recip.Name
next


Derived from: IDispatch


Properties


Count

integer. Returns the number of recipients in the recipients collection

 

 

_Item(Index)

Index - integer. A default object property.

Retrieves an recipient with a given index (1 to Count).

Returns RDORecipient object

 

 

 

RawTable

IUnknown, read-only. Returns the IMAPITable Extended MAPI interface (as returned by IMessage::GetRecipientTable in Extended MAPI) used internally by the RDORecipients collection

 

 

Session

RDOSession, read-only. Returns the parent MAPI session represented by the RDOSession object

 

 

MAPITable

MAPITable, read-only. Returns the MAPITable Redemption object which can be used to manipulate the collection (restrict, find, etc).

 

 

Parent

Returns the parent RDOMail object

 

 


Methods


Add(Source)

Adds a new recipient. Returns RDORecipient object.

 

Source - either a string (name or e-mail address) or RDORecipient or RDOAddressEntry object.

New in version 5.2: RDOContactItem or an RDODistListItem object (or event ContactItem or DistListItem from Outlook).

 

set Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
set Inbox = Session.GetDefaultFolder(olFolderInbox)
set Msg = Inbox.Items.Add
set Recip = Msg.Recipients.Add("Joe User")

Recip.Type = olCC
Recip.Resolve

 

AddEx(Name, Address, AddressType, Type)

Adds a new recipient. Returns RDORecipient object.

Unlike the Add() method, AddEx allows to add a recipient and resolve it in a single call; if all 4 parameters are specified, Redemption creates a recipient with a one-off entry id.

 

Name - string, recipient name

Address - string, recipient address

Address - string, address type (e.g. "SMTP")

Type - integer, recipient type (olTo, olCC, olBCC)

 

set Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
set Inbox = Session.GetDefaultFolder(olFolderInbox)
set Msg = Inbox.Items.Add
Msg.Recipients.AddEx("Dmitry", "dmitry@dimastr.com", "SMTP", olTo)
Msg.Recipients.ResolveAll

AddMultiple(Values, Type)
Adds multiple recipients in a single call.
Adding recipients one at a time can severely degrade the performance as the time it takes to add a single recipient is proportional to the number of existing recipients in a message. AddMultiple allows to add  hundreds of recipients in a single call with a performance improvement on the order of 100.

Values - variant array of string, RDORecipient, RDOAddressEntry, RDOContactItem or RDODistListItem objects.

Type -  variant, optional. Specifies the recipient type (olTo, olCC, olBCC). Defaults to olTo if not specified.

dim Recips(2)

Recips(0) = "dmitry@dimastr.com"

Recips(1) = "test@dimastr.com"

Recips(2) = "redemption@dimastr.com"

set Session = CreateObject("Redemption.RDOSession")

Session.MAPIOBJECT = Application.Session.MAPIOBJECT

set Contacts = Session.GetDefaultFolder(olFolderContacts)

set Drafts = Session.GetDefaultFolder(olFolderDrafts)

set Msg = Drafts.Items.Add

Msg.Recipients.AddMultiple(Recips. olTo)

Msg.Recipients.ResolveAll

Msg.Subject = "test"

Msg.Save

Clear
Removes all recipients from the message
 
ExpandDL(Recursive, PrivateDLOnly)
Replaces Distribution Lists in the message recipient list with the members of that list.

You can expand the Distribution Lists recursively and limit the expansion to only Private Distribution Lists - MAPIPDL Distribution Lists can only be accessed locally since they do not have  an externally meaningful address and only exist in the context of the store that contain the corresponding RDODistListItem object).
If successful (that is, any recipients were DLs and they were successfully expanded), returns true and false otherwise

Recursive - variant, optional. If true, expands the distribution lists recursively.
If not specified, defaults to True.

PrivateDLOnly - variant, optional. If true, only expands MAPIPDL Distribution Lists that exist on top of the RDODistListItem objects in the local store.

Item(Index)

Index - integer.

Retrieves an recipient with a given index (1 to Count).

Returns RDORecipient object

 

 

Remove(Index)

Removes an recipient with an index given by the Index parameter (integer, 1 through Count).

 

 

 

 

 

 

ResolveAll(ShowDialog, ParentWndHandle)

Resolves all message recipients. Resolves TRUE if successful.

 

ShowDialog - boolean, optional. If true and some recipients cannot be resolved or are ambiguous, displays the name resolution dialog.

ParentWndHandle - integer, optional. The window handle to be eused as the parent of the name resolution dialog.

 

set Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
set Inbox = Session.GetDefaultFolder(olFolderInbox)
set Msg = Inbox.Items.Add
Msg.To = "dmitry@dimastr.com; outspy@dimastr.com"
Msg.Recipients.ResolveAll