'Outlook appointment meeting organizer information inconsistent

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?



Solution 1:[1]

Recipient type olOrganizer (0) is not used at all. You can only have To / CC / BCC recipients (mapped to olRequired / olOptional / olResource for appointments).

On the MAPI level, the organizer is marked by the recipOrganizer bit (2) in the PR_RECIPIENT_FLAGS set on the recipient. You can see that property in OutlookSpy (I am its author) - select the appointment, click IMessage button, go to the GetRecipientTable tab, select the organizer, select the PR_RECIPIENT_FLAGS property, right click, "View Property".

Solution 2:[2]

I've also faced this issue and was investigating. This looks definitely like a bug in Outlook to me. I have opened a uservoice (for this one and another). Let's see if Microsoft will fix it. https://outlook.uservoice.com/forums/322590-outlook-for-windows-desktop-application/suggestions/42151741-outlook-vba-wrong-recipient-type-for-organizer-olm

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 Thierry Dalon