Availability Service
The EWS Java API makes it very easy to consume the Availability service. The Availability service makes it possible to retrieve free/busy information for users for whom the caller does not necessarily have access rights. It also provides meeting time suggestions.
The following example shows how to call the Availability service by using the EWS Java API.
// Create a list of attendees for which to request availability
// information and meeting time suggestions.
List<AttendeeInfo> attendees = new ArrayList<AttendeeInfo>();
attendees.add(new AttendeeInfo("test@contoso.com"));
attendees.add(new AttendeeInfo("temp@contoso.com"));
SimpleDateFormat formatter = new SimpleDateFormat("yyyy/MM/dd");
//minimum time frame allowed by API is 24 hours
Date start = formatter.parse("2010/05/18");
Date end = formatter.parse("2010/05/19");
// Call the availability service.
GetUserAvailabilityResults results = service.getUserAvailability(
attendees,
new TimeWindow(start, end),
AvailabilityData.FreeBusyAndSuggestions);
// Output attendee availability information.
int attendeeIndex = 0;
for (AttendeeAvailability attendeeAvailability : results.getAttendeesAvailability()) {
System.out.p