Recipients Property

Returns a Recipients collection that represents all the recipients for the Microsoft Outlook item. Read-only.

expression**.Recipients**

*expression   * Required. An expression that returns an AppointmentItem, JournalItem, MailItem, MeetingItem, or TaskItem object.

Remarks

Outlook blocks code that attempts to access the Recipients property for security reasons. If you run a third-party add-in, custom solution, or other program that uses the Recipients property 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".

Example

This Visual Basic for Applications (VBA) example creates a new e-mail message, uses the Add method to add "Dan Wilson" as a To recipient, and displays the message.

Sub CreateStatusReportToBoss()
    Dim myOlApp As Outlook.Application
    Dim myItem As Outlook.MailItem
    Dim myRecipient As Outlook.Recipient
    Set myOlApp = CreateObject("Outlook.Application")
    Set myItem = myOlApp.CreateItem(olMailItem)
    Set myRecipient = myItem.Recipients.Add("Dan Wilson")
    myItem.Subject = "Status Report"
    myItem.Display
End Sub

If you use Microsoft Visual Basic Scripting Edition (VBScript) in an Outlook form, you do not create the Application object, and you cannot use named constants. This example shows how to perform the same task using VBScript code.

Set myItem = Application.CreateItem(0)
Set myRecipient = myItem.Recipients.Add("Dan Wilson")
myItem.Subject = "Status Report"
myItem.Display

Applies to | AppointmentItem Object | JournalItem Object | MailItem Object | MeetingItem Object | TaskItem Object

See Also | BCC Property | CC Property | Recipients Object | StatusOnCompletionRecipients Property | StatusUpdateRecipients Property | To Property