Multiple objects![]() ![]() ![]() ![]() ![]() ![]() |
The Recipients object contains Recipient objects.
Use the Recipients property to return the Recipients object of an AppointmentItem, JournalItem, MailItem, MeetingItem or TaskItem object.
Use the Add method to create a new Recipient object and add it to the Recipients object. The Type property of a new Recipient object is set to the default for the associated AppointmentItem, JournalItem, MailItem or TaskItem object and must be reset to indicate another recipient type.
The following example creates a new MailItem object and adds Jon Grande as the recipient using the default type ("To").
Set myOlApp = CreateObject("Outlook.Application")
Set myItem = myOlApp.CreateItem(olMailItem)
Set myRecipient = myItem.Recipients.Add ("Jon Grande")
The following example creates the same MailItem object as the preceding example, and then changes the type of the Recipient object from the default ("To") to CC.
Set myOlApp = CreateObject("Outlook.Application")
Set myItem = myOlApp.CreateItem(olMailItem)
Set myRecipient = myItem.Recipients.Add ("Jon Grande")
myRecipient.Type = olCC
Use Recipients(index), where index is the name or index number, to return a single Recipient object.
Outlook blocks code that attempts to access the Recipients object for security reasons. If you run a third-party add-in, custom solution, or other program that uses the Recipients object in Office Outlook 2003, you may receive the following warning:
A program is trying to access e-mail addresses you have stored in Outlook. Do you want to allow this? If this is unexpected, it may be a virus and you should choose "No".