0
votes

I followed this guide to retrieve Meetings in Exchange made via Outlook; https://msdn.microsoft.com/en-us/library/office/dn495614(v=exchg.150).aspx

Everything runs fine, no exceptions but it doesn't return any results. I then tried FindItems instead of FindAppointments and this does return my results. Why does FindAppointments not return the meetings?

I'm creating test appointments in Outlook online. By clicking Menu > Calendar > New, I complete the details of the event and then add attendees before saving. These are returned by FindItems() but there doesn't seem to be a property to retrieve Location and Attendee list? Where FindAppointments would give me the properties I need if the data was returned. I have had Outlook installed on a computer previously where creating a meeting specifically mentions the word 'Meeting' where this appears to be calendar items. I'm not sure what the difference is?

My end goal is when users schedule meetings via Outlook and I'll have an application that retrieves details of those meetings inc. an attendee list and location.

Many thanks for any pointers!

2

2 Answers

0
votes

We need to add list of required items to property set, in the given example the property set is restricted. In property code

// Limit the properties returned to the appointment's subject, start time, and end time.
        cView.PropertySet = new PropertySet(AppointmentSchema.Subject, AppointmentSchema.Start, AppointmentSchema.End);

instead of above use below property set, cView.PropertySet = new PropertySet(AppointmentSchema.Subject, AppointmentSchema.Start, AppointmentSchema.End, AppointmentSchema.Location, AppointmentSchema.RequiredAttendees);

or the best for initial learning is

// Limit the properties returned to the appointment's subject, start time, and end time.
        cView.PropertySet = new PropertySet(BasePropertySet.FirstClassProperties);
0
votes

Manged to find a solution taken from this thread

The code could do with a tidy up but it correctly pulls down the appointments and allows me to get the data that I need.

FindItemsResults<Item> result = service.FindItems(WellKnownFolderName.Calendar, new CalendarView(DateTime.Now, DateTime.Now.AddDays(7)));
            foreach(Item item in result.Items)
            {
                ServiceResponseCollection<GetItemResponse> itemResponseCollection = service.BindToItems(new[] { new ItemId(item.Id.UniqueId) }, new PropertySet(BasePropertySet.FirstClassProperties));
                foreach(GetItemResponse itemResponse in itemResponseCollection)
                {
                    Appointment appointment = (Appointment)itemResponse.Item;
                    Console.WriteLine("Subject: " + appointment.Subject);
                    Console.WriteLine("Location: " + appointment.Location);

                    Console.WriteLine("AppointmentType: " + appointment.AppointmentType.ToString());
                    Console.WriteLine("Body: " + appointment.Body);
                    Console.WriteLine("End: " + appointment.End.ToString());
                    Console.WriteLine("UniqueId: " + appointment.Id.UniqueId);
                    Console.WriteLine("Start: " + appointment.Start.ToString());
                    Console.WriteLine("When: " + appointment.When);

                    Console.WriteLine("Required Attendees: ");
                    foreach (var attendee in appointment.RequiredAttendees)
                    {
                        Console.WriteLine(attendee.Name);
                    }
                }