如何使用EWS JAVA API获取访问其他邮箱日历的权限
我可以使用以下代码获得组织中可用的会议室,我需要获得特定会议室的预约,因此我使用了以下代码`如何使用EWS JAVA API获取访问其他邮箱日历的权限,java,calendar,exchangewebservices,ewsjavaapi,Java,Calendar,Exchangewebservices,Ewsjavaapi,我可以使用以下代码获得组织中可用的会议室,我需要获得特定会议室的预约,因此我使用了以下代码` public static void main(String[] args) throws Exception { // TODO Auto-generated method stub static ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010_SP2); ExchangeCr
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("xxx@yy.com", "zzzz");
service.setCredentials(credentials);
try {
System.out.println("Check");
service.autodiscoverUrl("xxx@yy.com",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("meetingroom-1@yy.com");
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();
}
}`
我想这可能是因为我没有访问会议室日历的权限。如何进一步获得预约。请帮帮我,我需要它在EWS-JavaAPI中
提前感谢。运行代码的帐户需要委托访问会议室的日历,才能使代码正常工作。这是管理员需要在服务器上为您配置的内容。除了获得管理员权限,还有其他方法吗。由于是公司办公室,我将无法获得管理员权限。你能给我建议一些其他的方法吗?你不需要管理员权限。您的帐户需要委托访问日历。如果您只需要查找房间空闲的时间,而不需要亲自阅读约会,那么另一个选项是检查他们的忙/闲信息:。这通常不需要任何特殊权限。
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)