[Exchange Web Services] Exchange Web Services - Can't find Delta parameter in GetAllAppointmentsByUser

Forge Component
(2)
Published on 2016-10-25 by Fernando Branco
2 votes
Published on 2016-10-25 by Fernando Branco

I'm using the GetAllAppointmentsByUser server action to retrieve data from Outlook. It seems to retrieve data only till current Friday. There is a mention of Delta parameter in the description but the example isn't very clear. It seems to be associated with ReferenceDay parameter.

How do I enter a custom timespan? Any help would be greatly appreciated.

Hi Krishanu,

I haven't use the component specifically, but it uses the Exchange Web Services API to retrieve a user's appointments. API provides the option to supply date range as start and end time. If it is not there in the component, could be extended to make it work.

Below example (from Exchange's API example) retrieve all appointments by a user.


           // Initialize values for the start and end times, and the number of appointments to retrieve.
            DateTime startDate = DateTime.Now;
            DateTime endDate = startDate.AddDays(30);
            const int NUM_APPTS = 5;

            // Initialize the calendar folder object with only the folder ID.
            CalendarFolder calendar = CalendarFolder.Bind(service, WellKnownFolderName.Calendar, new PropertySet());

            // Set the start and end time and number of appointments to retrieve.
            CalendarView cView = new CalendarView(startDate, endDate, NUM_APPTS);

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

            // Retrieve a collection of appointments by using the calendar view.
            FindItemsResults<Appointment> appointments = calendar.FindAppointments(cView);
            Console.WriteLine("\nThe first " + NUM_APPTS + " appointments on your calendar from " + startDate.Date.ToShortDateString() +
                              " to " + endDate.Date.ToShortDateString() + " are: \n");
           
            foreach (Appointment a in appointments)
            {
                Console.Write("Subject: " + a.Subject.ToString() + " ");
                Console.Write("Start: " + a.Start.ToString() + " ");
                Console.Write("End: " + a.End.ToString());
                Console.WriteLine();
            }

Swatantra,

Thanks for the reply. The API didn't have the To Date parameter, so we had to change the .net source code to add a week as per our requirement. Something like your suggestion,

DateTime endDate = startDate.AddDays(30);

That is now working.

Perfect!

Yeah, sometimes we have to extend the components, but that comes quite handy. Glad it worked.