我正在嘗試提取未取消的日曆會議,但發現錯誤請求已超時。我只在我的本地機器上運行它。請指教。使用EWS提取會議
ExchangeService service = new ExchangeService();
service.setTraceEnabled(true);
service.setUseDefaultCredentials(true);
service.setTraceEnabled(true);
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date startDate = formatter.parse("2015-01-01 00:00:00");
Date endDate = formatter.parse("2015-01-10 23:59:59");
try{
service.setUrl(new URI("https://outlook.office365.com/EWS/Exchange.asmx"));
CalendarFolder cal = CalendarFolder.bind(service, WellKnownFolderName.Calendar);
CalendarView calendarView = new CalendarView(startDate, startDate);
FindItemsResults<Appointment> findResults = cal.findAppointments(calendarView);
for (Appointment appt : findResults.getItems()) {
System.out.println("SUBJECT====="+appt.getSubject());
System.out.println("BODY========"+appt.getBody());
}
} catch (Exception e)
{
e.printStackTrace();
} // microsoft.exchange.webservices.data.exceptions.ServiceRequestException: The request failed. Connection timed out: connect caused by Caused by: java.net.ConnectException: Connection timed out: connect
聯繫您的IT部門,並確保您可以訪問互聯網,並獲得任何必要的代理服務器,這樣做說明。 –
嗨我可以在我的網絡瀏覽器中正常訪問辦公室360。我在想這是否是防火牆問題。但是我的代碼沒有錯,對嗎? – James