I am working on a VSTO add-in for Outlook, written in C# as a WFP application, and am running into an inconsistency in the Outlook provided data for the current selected appointment.
My add-in executes from a button in the appointment dialog. Here are the primary declarations I use to access information from the dialog:
Outlook.Application app = Globals.MyAddInApp.Application;
Outlook.AppointmentItem appt =
app.ActiveInspector().CurrentItem as Outlook.AppointmentItem;
If I open an existing meeting and look at information in appt
, the appt.Organizer
gives me the name of the meeting organizer as expected. However, if I examine appt.Recipients
:
string organizer;
foreach (Outlook.Recipient attendee in appt.Recipients)
{
switch ((Outlook.OlMeetingRecipientType)attendee.Type)
{
case Outlook.OlMeetingRecipientType.olOrganizer:
organizer = attendee.Name;
break;
case Outlook.OlMeetingRecipientType.olRequired:
// ...
break;
case Outlook.OlMeetingRecipientType.olOptional:
// ...
break;
case Outlook.OlMeetingRecipientType.olResource:
// ...
break;
}
}
I'm finding that the meeting organizer has a type of olRequired
not type olOrganizer
. The organizer
string in the above code is not set to the name of the organizer. The appointment dialog "Scheduling Assistant" clearly indicates the organizer, so I'm confused as to how the Type
is showing up as olRequired
and not olOrganizer
.
It would seem odd to me that I can't just use the Type
field to determine the roll of an attendee. Do I really have to check the Organizer
attribute against the names in the Recipients
to detect the organizer in the Recipients
list?