none
[EWS Managed API] How to judge whether occurence of recurring meeting is cancelled? RRS feed

  • Question

  • Hi All,

    I use EWS Managed API 1.1 to search all uncancelled Appointments of meetingroom mailbox's Calendar.

    If one occurence of the recurring meeting is cancelled, but when I searched, the "appointment.IsCancelled" is still false. So how can I judge the occurence is cancelled?

    Here's the code:

                service.AutodiscoverUrl(meetingRoom.RoomEmail);
                ItemView view = new ItemView(int.MaxValue);
                view.PropertySet = new PropertySet(BasePropertySet.IdOnly, ItemSchema.Subject, ItemSchema.DateTimeReceived,
                    AppointmentSchema.Start, AppointmentSchema.End, AppointmentSchema.Organizer);

                view.OrderBy.Add(ItemSchema.DateTimeReceived, Microsoft.Exchange.WebServices.Data.SortDirection.Descending);
                view.Traversal = ItemTraversal.Shallow;
                FolderId folderId = new FolderId(WellKnownFolderName.Calendar, meetingRoom.RoomEmail);

                List<SearchFilter> searchFilterCollection = new List<SearchFilter>();
                searchFilterCollection.Add(new SearchFilter.IsGreaterThan(AppointmentSchema.End, startDate));
                searchFilterCollection.Add(new SearchFilter.IsLessThan(AppointmentSchema.Start, endDate));

                SearchFilter searchFilter = new SearchFilter.SearchFilterCollection(LogicalOperator.And, searchFilterCollection.ToArray());

                FindItemsResults<Item> findResults = service.FindItems(folderId, searchFilter, view);

                foreach (Item myItem in findResults.Items)
                {
                    if (myItem is Appointment)
                    {
                        Appointment appointment = myItem as Appointment;
                        PropertySet propertyset = view.PropertySet;
                        propertyset.Add(AppointmentSchema.IsCancelled);
                        appointment.Load(propertyset);

                        if (appointment.IsCancelled == false)
                        {

                               .......................

                        }

                     }

                 }

    Tuesday, May 15, 2012 5:25 AM