0
votes

Has any one used ews-java-api to retrieve calendar data from microsoft exchange 365 ? If so are there any help links or document that you can share ?

1

1 Answers

1
votes

Using the documentation for the ews-java-api, you can use this method to get all appointments on the calendar between startDate and endDate in the specified folder, including recurring meeting occurrences.

public void findAppointments(CalendarFolder folder, Date startDate, Date endDate) {
    SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    Date startDate = formatter.parse("2010-05-01 12:00:00");
    Date endDate = formatter.parse("2010-05-30 13:00:00");
    CalendarFolder cf=CalendarFolder.bind(service, WellKnownFolderName.Calendar);
    FindItemsResults<Appointment> findResults = cf.findAppointments(new CalendarView(startDate, endDate));
    for (Appointment appt : findResults.getItems()) {
        System.out.println("SUBJECT====="+appt.getSubject());
        System.out.println("BODY========"+appt.getBody());
    }
}

Do note, there are things you need to setup prior to implementing this method, I recommend reading the github documentation.