共用方式為


Outlook (Recipient.Type 屬性)

會傳回或設定代表收件者類型的 Long。 讀取/寫入。

語法

表情

一個代表 接收者 物件的變數。

註解

根據收件者的類型,這個屬性會傳回或設定 Long,此值對應至與下列其中一個常數相等的數值:

此屬性不一定會傳回會議室的適當收件者類型。 例如,會議邀請中可能指定會議室為必要的收件者,但此屬性卻不會傳回該會議室的 olResource

要可靠判斷收件人是否為會議室,請使用 Messaging API (MAPI) 屬性 PidTagDisplayTypeEx,該物件為接收者物件。 你可以使用 Outlook 物件模型中的 PropertyAccessor 物件來存取這個屬性。 PidTagDisplayTypeEx 屬性表示為「http://schemas.microsoft.com/mapi/proptag/0x39050003"在 MAPI proptag 命名空間中。 請注意,Microsoft Exchange Server 2007 之前的 Microsoft Exchange Server 版本中無法使用 PidTagDisplayTypeEx 屬性;在這些較早的 Exchange Server 版本中,可以使用 Recipient.Type 屬性,並假設類型不是 olResource 的收件者並非會議室。

範例

下列 Visual Basic for Applications (VBA) 範例會顯示如何在會議邀請的 Recipients 集合中的每一個 Recipient 物件的 PidTagDisplayTypeEx 屬性上使用 PropertyAccessor。 如果該屬性的值是 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 將會議狀態設定為「Meeting」,將其轉為包含必填與可選出席者的會議請求。 為避免發生錯誤,收件者名稱應該取代成有效的名稱。

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 支援與意見反應