1
votes

I am trying to integrate exchange calendar with my custom calendar. Till now i am able to integrate new creation of meeting from my calendar to Exchange.

But the issue i am facing is from Exchange to my calendar. If i create a new meeting in outlook, and and if i search it through below code i am getting results.

<code>

CalendarFolder calendarFolder = CalendarFolder.bind(eService,     WellKnownFolderName.Calendar);
CalendarView calendarView = new CalendarView(startOfMonth.toDate(), endOfMonth.toDate());
FindItemsResults<Appointment> aprilMeetings = alendarFolder.findAppointments(calendarView);
</code>

in above list i am getting all meetings between start and end date. My question is how to identify whether its a new meeting or updated meeting or canceled meeting.

I tried these methods,

<code>
appointment.getIsNew().
appointment.getIsCancelled()
appointment.getIsUnmodified()
</code>

But all above methods return false. I need to find a way to figure out this so that i can sync items from my Exchange Server to my custom application (Note: I am also creating iCal file in my application, so i can use my application when exchange is not connected).

Regards.

1

1 Answers

2
votes

you can use the following code to get updated/new meetings.

Date startDate1 = formatter.parse("2014-04-25 07:00:00");
SearchFilter filter = new SearchFilter.IsGreaterThanOrEqualTo(ItemSchema.LastModifiedTime,startDate1);

FindItemsResults<Item> findResults = exchange.findItems(WellKnownFolderName.Calendar, filter, new ItemView(10));
for (Item item : findResults.getItems())
{
    Appointment appt = (Appointment)item;
    System.out.println("SUBJECT====="+appt.getSubject());
    System.out.println("Location========"+appt.getLocation());
    System.out.println("Start Time========"+appt.getStart());
    System.out.println("End Time========"+appt.getEnd());
    System.out.println("Email Address========"+ appt.getOrganizer().getAddress());
    System.out.println("Last Modified Time========"+appt.getLastModifiedTime());

}