Outlook) (Recipient.Type 属性

返回或设置一个 Long 表示收件人的类型。 读/写。

语法

表达式类型

表达 一个代表 Recipient 对象的变量。

备注

根据收件人的类型,此属性返回或设置一个 对应数值相当于下列常量之一:

此属性可能不会始终返回会议室的相应收件人类型。 例如,会议室可能指定为会议要求中的必选收件人,在此情况下,此属性不会返回该会议室的 olResource

若要可靠地确定收件人是会议室,使用消息传递 API (MAPI) 属性, PidTagDisplayTypeEx收件人 对象。 您可以访问 Outlook 对象模型中使用 PropertyAccessor 对象的该属性。 PidTagDisplayTypeEx 属性表示为“http://schemas.microsoft.com/mapi/proptag/0x39050003"在 MAPI proptag 命名空间中。 请注意, PidTagDisplayTypeEx 属性在中不可用的 Microsoft Exchange Server 版本早于 Microsoft Exchange Server 2007 年;在 Exchange Server 这种早期版本中,可以使用 Recipient.Type 属性,并假定有一个 olResource 不同类型的收件人不是会议室。

示例

下面的 Visual Basic for Applications (VBA) 示例说明如何将 PropertyAccessor 用于会议要求的 Recipients 集合中的每个 Recipient 对象的 PidTagDisplayTypeEx 属性。 如果该属性的值为 7(在 MAPI 头文件 mapidefs.h 中定义的 MAPI 常量 DT_ROOM 的值),则该收件人为会议室。 此示例假定当前检查器中有会议要求。

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

以下 VBA 示例使用 CreateItem 来创建约会,并使用 MeetingStatus 会议将状态设置为"会议",以将其转换成的必选和可选与会者的会议要求。 使用有效的名称以避免错误,应更换收件人的姓名。

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

另请参阅

收件人对象

引用的命名空间属性

支持和反馈

有关于 Office VBA 或本文档的疑问或反馈? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。