Quantcast
Channel: Exchange Server Development forum
Viewing all articles
Browse latest Browse all 7132

Facing issue in suggested meeting time in ews-java-api

$
0
0

Hi,

I have a meeting room id , and i want to get Free and Busy schedule of the meeting room , below is the code i am using

List<AttendeeInfo> attendees = new ArrayList<AttendeeInfo>();
			attendees.add(new AttendeeInfo(meetingroom@yy.com));


 SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
			    Date startDate = formatter.parse("2015-03-03 00:00:00");
			    Date endDate = formatter.parse("2015-03-05 00:00:00");



			// Call the availability service.
			GetUserAvailabilityResults results = exchangService.getUserAvailability(
				attendees,
				new TimeWindow(startDate, endDate),
				AvailabilityData.FreeBusyAndSuggestions);

			// Output attendee availability information.
			int attendeeIndex = 0;

			for (AttendeeAvailability attendeeAvailability : results.getAttendeesAvailability()) {
				System.out.println("Availability for " + attendees.get(attendeeIndex).getSmtpAddress());
				//if (attendeeAvailability.getErrorCode() == ServiceError.NoError) {
					for (CalendarEvent calendarEvent : attendeeAvailability.getCalendarEvents()) {
						System.out.println("Calendar event : "+ calendarEvent.getFreeBusyStatus().toString());
						System.out.println("  Start time: " + calendarEvent.getStartTime().toString());
						System.out.println("  End time: " + calendarEvent.getEndTime().toString());

						if (calendarEvent.getDetails() != null)
						{
							System.out.println("  Subject: " + calendarEvent.getDetails().getSubject());
							// Output additional properties.
						}
					}
				//}

				attendeeIndex++;
			}
			for (Suggestion suggestion : results.getSuggestions()) {
				System.out.println("Suggested day: " + suggestion.getDate().toString());
				//System.out.println("Overall quality of the suggested day: " + suggestion.getQuality().toString());

				for (TimeSuggestion timeSuggestion : suggestion.getTimeSuggestions()) {
				System.out.println("Suggested time: " + timeSuggestion.getMeetingTime().toString());
					// Output additonal properties.
				}
			}




		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		

I am getting output like,

Calendar event : Busy
  Start time: Tue Mar 03 10:00:00 GMT+05:30 2015
  End time: Tue Mar 03 17:00:00 GMT+05:30 2015
Calendar event : Busy
  Start time: Wed Mar 04 12:00:00 GMT+05:30 2015
  End time: Wed Mar 04 13:00:00 GMT+05:30 2015
Calendar event : Busy
  Start time: Wed Mar 04 13:00:00 GMT+05:30 2015
  End time: Wed Mar 04 18:30:00 GMT+05:30 2015

Suggested day: Tue Mar 03 00:00:00 GMT+05:30 2015
Suggested time: Tue Mar 03 17:00:00 GMT+05:30 2015
Suggested time: Tue Mar 03 17:30:00 GMT+05:30 2015
Suggested time: Tue Mar 03 18:00:00 GMT+05:30 2015
Suggested time: Tue Mar 03 18:30:00 GMT+05:30 2015
Suggested time: Tue Mar 03 19:00:00 GMT+05:30 2015
Suggested time: Tue Mar 03 19:30:00 GMT+05:30 2015
Suggested time: Tue Mar 03 20:00:00 GMT+05:30 2015
Suggested time: Tue Mar 03 20:30:00 GMT+05:30 2015
Suggested time: Tue Mar 03 21:00:00 GMT+05:30 2015Suggested time: Tue Mar 03 21:30:00 GMT+05:30 2015
Suggested day: Wed Mar 04 00:00:00 GMT+05:30 2015
Suggested time: Wed Mar 04 05:30:00 GMT+05:30 2015
Suggested time: Wed Mar 04 06:00:00 GMT+05:30 2015
Suggested time: Wed Mar 04 06:30:00 GMT+05:30 2015
Suggested time: Wed Mar 04 07:00:00 GMT+05:30 2015
Suggested time: Wed Mar 04 07:30:00 GMT+05:30 2015
Suggested time: Wed Mar 04 08:00:00 GMT+05:30 2015
Suggested time: Wed Mar 04 08:30:00 GMT+05:30 2015
Suggested time: Wed Mar 04 09:00:00 GMT+05:30 2015
Suggested time: Wed Mar 04 09:30:00 GMT+05:30 2015Suggested time: Wed Mar 04 10:00:00 GMT+05:30 2015

In the above output, for the corresponding date Mar 03, it is showing busy time correctly, but in the suggested time which is free , it is showing until 21.30 only, it need to showed until 23.30 as that also a suggested time which is free, Similarly, in next day ie. Mar 04, it shows busy time correctly, but suggested time which is free is shown until 10:00 am only, why it is not showing after 10 am. Please help me to solve this issue and how to proceed further to show the remaining free meeting time also.

Thanks,

Akshea.


Viewing all articles
Browse latest Browse all 7132

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>