檢查會議邀請的所有回應
此範例示範如何檢查每個收件者對會議邀請的響應狀態。
範例
注意事項
下列程式代碼範例是 Microsoft Office Outlook 2007 程式設計應用程式的摘錄。
在下列程式代碼範例中,CheckAttendeeStatus 會列舉代表會議邀請之 AppointmentItem 物件的 Recipients 集合,並檢查每個 Recipient 物件的 MeetingResponseStatus 屬性。 每個 Recipient 物件都代表會議邀請的收件者。 MeetingResponseStatus 属性的值可以是下列其中一個 OlResponseStatus 列舉值:
- olResponseAccepted
- olResponseDeclined
- olResponseNone
- olResponseNotResponded
- olResponseOrganized
- olResponseTentative
If you use Visual Studio to test this code example, you must first add a reference to the Microsoft Outlook 15.0 Object Library component and specify the Outlook variable when you import the Microsoft.Office.Interop.Outlook namespace. The using statement must not occur directly before the functions in the code example but must be added before the public Class declaration. The following line of code shows how to do the import and assignment in C#.
using Outlook = Microsoft.Office.Interop.Outlook;
private void CheckAttendeeStatus()
{
Outlook.AppointmentItem appt = Application.Session.
GetDefaultFolder(Outlook.OlDefaultFolders.olFolderCalendar).
Items.Find("[Subject]='Sales Strategy FY2007'")
as Outlook.AppointmentItem;
if (appt != null)
{
foreach (Outlook.Recipient recip in appt.Recipients)
{
switch (recip.MeetingResponseStatus)
{
case Outlook.OlResponseStatus.olResponseAccepted:
Debug.WriteLine("Accepted: " + recip.Name);
break;
case Outlook.OlResponseStatus.olResponseTentative:
Debug.WriteLine("Tentative: " + recip.Name);
break;
case Outlook.OlResponseStatus.olResponseDeclined:
Debug.WriteLine("Declined: " + recip.Name);
break;
case Outlook.OlResponseStatus.olResponseOrganized:
Debug.WriteLine("Organizer: " + recip.Name);
break;
case Outlook.OlResponseStatus.olResponseNone:
Debug.WriteLine("None: " + recip.Name);
break;
case Outlook.OlResponseStatus.olResponseNotResponded:
Debug.WriteLine("Not responded: " + recip.Name);
break;
}
}
}
}