Recipient Object

Microsoft Outlook Visual Basic

Recipient Object

Multiple objects Recipients
Recipient
AddressEntry

Represents a user or resource in Outlook, generally a mail message addressee.

Using the Recipient Object

Use Recipients (index), where index is the name or index number, to return a single Recipient 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, MeetingItem or TaskItem object and must be reset to indicate another recipient type.

The following Visual Basic for Applications (VBA) 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 Visual Basic for Applications 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
		

Remarks

If a program tries to reference any type of recipient information by using the Outlook object model, a dialog box is displayed that asks you to confirm access to this information. You can allow access to the Address Book or recipient information for up to ten minutes after you receive the dialog box. This allows features, such as mobile device synchronization, to be completed.

You receive the confirmation dialog box when a solution tries to programmatically access the Recipient object.