I am able to get the meeting rooms available in my Organisation using the below code, I need to get the appointment of the particular room, so i have used the below code for it.`
public static void main(String[] args) throws Exception {
// TODO Auto-generated method stub
static ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010_SP2);
ExchangeCredentials credentials = new WebCredentials("[email protected]", "zzzz");
service.setCredentials(credentials);
try {
System.out.println("Check");
service.autodiscoverUrl("[email protected]",new RedirectionUrlCallback());
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
NameResolutionCollection nameResolutions = service.resolveName("MeetingRoom1",ResolveNameSearchLocation.DirectoryOnly, true);
System.out.println("nameResolutions==="+nameResolutions.getCount());
for(NameResolution nameResolution : nameResolutions)
{
System.out.println("NAME==="+nameResolution.getContact().getDisplayName());
}
Date startDate = new Date();
Calendar cal = Calendar.getInstance();
cal.setTime(startDate);
cal.add(Calendar.DATE, 30); // add 10 days
Date endDate = cal.getTime();
Mailbox meetingMailbox = new Mailbox("[email protected]");
FolderId CalendarId = new FolderId(WellKnownFolderName.Calendar, meetingMailbox);
CalendarView cView = new CalendarView(startDate, endDate);
FindItemsResults<Appointment> appointments = service.findAppointments(CalendarId, cView);
for (Appointment a : appointments)
{
System.out.println("Subject: " + a.getSubject().toString() + " ");
System.out.println("Start: " + a.getStart().toString() + " ");
System.out.println("End: " + a.getEnd().toString());
System.out.println();
}
}`
If i execute this code, i am able to get the list of all meeting room available in my Organisation with name MeetingRoom1, then i am trying to access the particular [email protected] to get the appointments for that room ,but throwing some exception like below.
Exception in thread "main" microsoft.exchange.webservices.data.ServiceResponseException: The specified folder could not be found in the store.
at microsoft.exchange.webservices.data.ServiceResponse.internalThrowIfNecessary(ServiceResponse.java:262)
at microsoft.exchange.webservices.data.ServiceResponse.throwIfNecessary(ServiceResponse.java:251)
at microsoft.exchange.webservices.data.MultiResponseServiceRequest.execute(MultiResponseServiceRequest.java:146)
at microsoft.exchange.webservices.data.ExchangeService.findItems(ExchangeService.java:807)
at microsoft.exchange.webservices.data.ExchangeService.findAppointments(ExchangeService.java:1089)
at com.hcl.GetRoomClass.main(GetRoomClass.java:58)
I guess it may be due to that i dont have access rights to access the calendar of the meeting room. How to proceed further to get the appointment. please help me .I need it in EWS-JAVA API.
Thanks in advance.