none
EWS Appointment Categories RRS feed

  • Question

  • We have Exchange 2010 SP2. I'm building a custom application that does certain tasks based on how a user categorizes their appointments in their calendar. The problem I'm running into is that I can't seem to retrieve the categories for any Appointment. I've tried specifically loading the property in a PropertySet using AppointmentSchema.Categories, along with the first class properties. However the categories StringList is still empty. I've also verified on the appointments through Outlook that they do indeed list several categories.

    Does anyone know how to retrieve the categories that were set for a specific appointment using EWS?

    Thanks.

    Friday, January 24, 2014 11:35 PM

Answers

  • I take it from this line

    EmailAddress oRoomEmail = new EmailAddress(strEmailAddress)

    This this is a Meeting Room Mailbox that your having problems with?

    Have you actually checked the Appointments in the Meeting room calendar to ensure the categories are set ?, categories are considered private information to the sender so as a generally rule aren't sent or maintained by the recipient so I would say if you look specifically at the meeting room mailbox the appointment won't have categories set even if they where sent with the appointments. Also be aware of http://www.slipstick.com/outlook/email/sending-categories-on-email-messages/

    Cheers
    Glen

    • Marked as answer by Brad Wilcox Tuesday, January 28, 2014 2:42 PM
    Tuesday, January 28, 2014 4:19 AM

All replies

  • What does your code look like ?

    If the strongly typed doesn't work (it should really) the extended property should work as an alternative eg

                ExtendedPropertyDefinition PidNameKeywords = new ExtendedPropertyDefinition(DefaultExtendedPropertySet.PublicStrings,"Keywords",MapiPropertyType.StringArray);
                PropertySet exPropSet = new PropertySet(BasePropertySet.FirstClassProperties);
                exPropSet.Add(PidNameKeywords);
                CalendarView cldView = new CalendarView(DateTime.Now.AddDays(-300), DateTime.Now,1000);
                cldView.PropertySet = exPropSet;
                FindItemsResults<Appointment> Appointments = service.FindAppointments(WellKnownFolderName.Calendar, cldView);
                foreach (Appointment apt in Appointments.Items) { 
                    object Keywords = null;
                    if (apt.TryGetProperty(PidNameKeywords, out Keywords)) {
                        Console.WriteLine(Keywords);
                        if (Keywords is Array)
                        {
                            foreach (String Keyword in (String[])Keywords)
                            {
                                Console.WriteLine(Keyword);
                            }
                        }
                        else {
                            Console.WriteLine(Keywords);
                        }
                    }
                }
    Cheers
    Glen

    Monday, January 27, 2014 5:04 AM
  • Thanks for your reply Glen.

    Below is my code which now includes your suggestion for loading the extended property. I'm still not getting any results in the categories or in the extended properties. I've tried including the PropertySet in both the CalendarView and the Appointment.Load event, and then I tried each individually. Still no values.

    ExtendedPropertyDefinition PidNameKeywords = new ExtendedPropertyDefinition(DefaultExtendedPropertySet.PublicStrings, "Keywords", MapiPropertyType.StringArray);
    
    PropertySet oLoadProps = new PropertySet(BasePropertySet.FirstClassProperties, AppointmentSchema.Categories);
    
    oLoadProps.Add(PidNameKeywords);
    
    EmailAddress oRoomEmail = new EmailAddress(strEmailAddress);
    
    FolderId oFolder = new FolderId(WellKnownFolderName.Calendar, new Mailbox(oRoomEmail.Address, oRoomEmail.RoutingType));
                    
    CalendarView oView = new CalendarView(datStartDate, datEndDate);
    oView.PropertySet = oLoadProps;
    
    FindItemsResults<Appointment> oAppointments = this.EService.FindAppointments(oFolder, oView);
    
    foreach (Appointment oAppt in oAppointments.Items)
    {
       try
       {
          oAppt.Load(oLoadProps);
          lstEvents.Add(ParseAppointment(oAppt, strHexColor, oRoomEmail.Address));
       }
       catch (Exception)
       {
          //TODO: Notify User of exception
       }
    }

    Thanks.

    Brad

    Monday, January 27, 2014 3:44 PM
  • I take it from this line

    EmailAddress oRoomEmail = new EmailAddress(strEmailAddress)

    This this is a Meeting Room Mailbox that your having problems with?

    Have you actually checked the Appointments in the Meeting room calendar to ensure the categories are set ?, categories are considered private information to the sender so as a generally rule aren't sent or maintained by the recipient so I would say if you look specifically at the meeting room mailbox the appointment won't have categories set even if they where sent with the appointments. Also be aware of http://www.slipstick.com/outlook/email/sending-categories-on-email-messages/

    Cheers
    Glen

    • Marked as answer by Brad Wilcox Tuesday, January 28, 2014 2:42 PM
    Tuesday, January 28, 2014 4:19 AM
  • You are correct. This is for meeting rooms. I should have mentioned that in the beginning.

    The problem is with the categories being private information. The user who added the categories can see them, but no one else can.

    We'll evaluate that link you sent. Thanks for your help.

    Brad

    Tuesday, January 28, 2014 2:45 PM