Recipient.Type property (Outlook)

Returns or sets a Long representing the type of recipient. Read/write.

Syntax

expression.Type

expression A variable that represents a Recipient object.

Remarks

Depending on the type of recipient, this property returns or sets a Long corresponding to the numeric equivalent of one of the following constants:

This property may not always return the appropriate recipient type for a conference room. For instance, a conference room may be specified as a required recipient in a meeting request, in which case this property will not return olResource for that conference room.

To reliably determine if a recipient is a conference room, use the Messaging API (MAPI) property, PidTagDisplayTypeEx, of the Recipient object. You can access this property using the PropertyAccessor object in the Outlook object model. The PidTagDisplayTypeEx property is represented as "http://schemas.microsoft.com/mapi/proptag/0x39050003" in the MAPI proptag namespace. Note that the PidTagDisplayTypeEx property is not available in versions of Microsoft Exchange Server earlier than Microsoft Exchange Server 2007; in such earlier versions of Exchange Server, you can use the Recipient.Type property and assume that a recipient having a type other than olResource is not a conference room.

Example

The following Visual Basic for Applications (VBA) example shows how to use the PropertyAccessor on the PidTagDisplayTypeEx property for each of the Recipient objects in the Recipients collection of a meeting request. If the value of that property is 7 (the value for the MAPI constant DT_ROOM as defined in the MAPI header file, mapidefs.h), then that recipient is a conference room. This example assumes that there is a meeting request in the current inspector.

Sub DemoMeetingRecipients() 
 Dim myAppointment As Outlook.AppointmentItem 
 Dim myPA As Outlook.PropertyAccessor 
 Dim d As Long 
 Dim myInt As Long 
 
 Set myAppointment = Application.ActiveInspector.CurrentItem 
 
 For d = 1 To myAppointment.Recipients.count 
 Debug.Print myAppointment.Recipients.item(d).name 
 Debug.Print myAppointment.Recipients.item(d).Type 
 Set myPA = myAppointment.Recipients.item(d).PropertyAccessor 
 myInt = myPA.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x39050003") 
 Debug.Print myInt 
 Debug.Print "---" 
 Next d 
End Sub

The following VBA example uses CreateItem to create an appointment and uses MeetingStatus to set the meeting status to "Meeting" to turn it into a meeting request with both a required and an optional attendee. The recipient names should be replaced with valid names to avoid errors.

Sub ScheduleMeeting() 
 Dim myItem as Outlook.AppointmentItem 
 Dim myRequiredAttendee As Outlook.Recipient 
 Dim myOptionalAttendee As Outlook.Recipient 
 Dim myResourceAttendee As Outlook.Recipient 
 
 Set myItem = Application.CreateItem(olAppointmentItem) 
 myItem.MeetingStatus = olMeeting 
 myItem.Subject = "Strategy Meeting" 
 myItem.Location = "Conference Room B" 
 myItem.Start = #9/24/2003 1:30:00 PM# 
 myItem.Duration = 90 
 Set myRequiredAttendee = myItem.Recipients.Add ("Nate Sun") 
 myRequiredAttendee.Type = olRequired 
 Set myOptionalAttendee = myItem.Recipients.Add ("Kevin Kennedy") 
 myOptionalAttendee.Type = olOptional 
 Set myResourceAttendee = myItem.Recipients.Add("Conference Room B") 
 myResourceAttendee.Type = olResource 
 myItem.Display 
End Sub

See also

Recipient Object

Referencing Properties by Namespace

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.