我使用 com.microsoft.ews-java-api:ews-java-api:2.0 在MS Exchange日历中创建和更新约会。两者都在我的测试环境中正常工作。在客户环境(不同的Exchange服务器)上创建约会有效但更新它运行以下代码会导致异常。
// Init
ExchangeService exchangeService = new ExchangeService(ExchangeVersion.Exchange2010_SP2);
WebCredentials webCredentials = new WebCredentials(exchangeUser, exchangePassword);
URI exchangeUri = new URI(exchangeUrl);
exchangeService.setCredentials(webCredentials);
exchangeService.setUrl(exchangeUri);
// Creating an appointment. This works on both environments.
Mailbox mailbox = new Mailbox("some@mail.com");
FolderId folderId = new FolderId(WellKnownFolderName.Calendar, mailbox);
Appointment appointment = new Appointment(exchangeService);
appointment.save(folderId);
// Keep ID for updating later on ...
model.setAppointmentId(appointment.getId().getUniqueId());
// ...
// Updating an appointment. This only works on my test environment.
ItemId itemId = new ItemId();
itemId.setUniqueId(model.getAppointmentId());
Appointment appointment = Appointment.bind(exchangeService, itemId); // The exception occurs here!
appointment.update(ConflictResolutionMode.AlwaysOverwrite);
这是我得到的例外
microsoft.exchange.webservices.data.core.exception.service.remote.ServiceResponseException: An internal server error occurred. The operation failed.
at microsoft.exchange.webservices.data.core.response.ServiceResponse.internalThrowIfNecessary(ServiceResponse.java:278)
at microsoft.exchange.webservices.data.core.response.ServiceResponse.throwIfNecessary(ServiceResponse.java:267)
at microsoft.exchange.webservices.data.core.request.MultiResponseServiceRequest.execute(MultiResponseServiceRequest.java:165)
at microsoft.exchange.webservices.data.core.ExchangeService.internalBindToItems(ExchangeService.java:1343)
at microsoft.exchange.webservices.data.core.ExchangeService.bindToItem(ExchangeService.java:1378)
at microsoft.exchange.webservices.data.core.ExchangeService.bindToItem(ExchangeService.java:1395)
at microsoft.exchange.webservices.data.core.service.item.Appointment.bind(Appointment.java:118)
at microsoft.exchange.webservices.data.core.service.item.Appointment.bind(Appointment.java:133)
An internal server error occurred. The operation failed.
并不是一个非常有用的例外。任何想法为什么失败?或者如何获得更多信息?