none
EWS API Exchange 2013 get body of calendar event RRS feed

  • Question

  • Hello,

     

    We’re trying to display list of upcoming events (calendar appointments) and their details from Exchange account on our website site. Actually, we are trying to migrate from Exchange 2010 to Exchange 2013. So far, we’ve been able to successfully display the event list with Appointment Date. Location and Subject using the EWS service. The last piece we are missing is a Body text. This value is nicely shown when using 2010, however using the 2013 EWS service it is returned empty (as shown on the screenshot below). For our testing purposes we are using the EWSEditor tool (1.13.0.24860), but the result is the same using API code.

     

    As for the code – it is very similar to 2010 version with only difference that we need to use impersonation feature in 2013 and we’ve setup the Exchange version to Exchange2013_SP1.

     

    The following code shows how we retrieve the appointment info:

     

    // Set the start and end time and number of appointments to retrieve.

    CalendarView cView = new CalendarView(startDate, endDate);

     

    // Limit the properties returned to the appointment's subject, start time, and end time.

    cView.PropertySet = new PropertySet(AppointmentSchema.Subject, AppointmentSchema.Body,AppointmentSchema.Start, AppointmentSchema.End, AppointmentSchema.Location,AppointmentSchema.MyResponseType);

     

    // Retrieve a collection of appointments by using the calendar view.

    FolderId shareFolderId = new FolderId(WellKnownFolderName.Calendar, new Mailbox(this.MailBox));

    CalendarFolder.Bind(es, shareFolderId);

    FindItemsResults<Appointment> appointments = es.FindAppointments(shareFolderId, cView);

     

    // Fill the data table

    foreach (Appointment a in appointments)

    {

        if (a.MyResponseType == MeetingResponseType.Accept)

        {

            DataRow nw = dt.NewRow();

            nw["AppointmentID"] = URLHelper.EncodeQueryString(a.Id.ToString()).Replace("+""%2B");

            nw["Subject"] = a.Subject.ToString();

            nw["Body"] = a.Body.ToString();

            nw["StartDateTime"] = ValidationHelper.GetDateTime(a.Start.ToString(), DateTime.MinValue);

            nw["EndDateTime"] = ValidationHelper.GetDateTime(a.End.ToString(), DateTime.MinValue);

            if (a.Location != null)

            {

                nw["Location"] = a.Location.ToString();

            }

            nw["DocumentType"] = "exchange.appointment";

            dt.Rows.Add(nw);

        }

    }

    Do you have any clue what we are doing wrong when dealing with Body text in Exchange 2013? Are there any additional steps we are missing?

    Thank you

    Tuesday, April 5, 2016 2:25 PM

All replies