ews-java-api:项目更新出错:至少有一个收件人无效

时间:2016-06-27 12:09:41

标签: java exchangewebservices

我正在开发一个工具,它使用ews-java-api在Outlook议程中创建,更新和删除日历项目。它一直工作正常,但现在有时当它试图更新某个日历项时,我得到以下错误:

microsoft.exchange.webservices.data.core.exception.service.remote.ServiceResponseException: At least one recipient isn't valid., A message can't be sent because it contains no recipients.
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.internalUpdateItems(ExchangeService.java:691)
at microsoft.exchange.webservices.data.core.ExchangeService.updateItem(ExchangeService.java:762)
at microsoft.exchange.webservices.data.core.service.item.Item.internalUpdate(Item.java:279)
at microsoft.exchange.webservices.data.core.service.item.Item.update(Item.java:400)
at be.vrt.quintiqexchange.main.QuintiqAdapter.insertUpdateCalendarItems(QuintiqAdapter.java:879)
at be.vrt.quintiqexchange.main.QuintiqAdapter.updateCalendarItems(QuintiqAdapter.java:796)
at be.vrt.quintiqexchange.main.QuintiqAdapter.run(QuintiqAdapter.java:286)
at java.lang.Thread.run(Thread.java:745)

最近所有的Exchange帐户都已从本地Outlook服务器迁移到Office365云服务器。也许这与它有关?或者任何人都知道出了什么问题?

以下代码是为项目执行更新:

Item it = alitems.get(i);
...
it.update(ConflictResolutionMode.AlwaysOverwrite);

以下是用于访问office365 ews的网址:

exchangewebservice = https://outlook.office365.com/EWS/Exchange.asmx

提前致谢

编辑:我使用的是ews-java-api 2.0版

编辑:在这里你可以看到错误发生在一行而不是下一行,同一收件人不会发生......

microsoft.exchange.webservices.data.core.exception.service.remote.ServiceResponseException: At least one recipient isn't valid., A message can't be sent because it contains no recipients.
    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.internalUpdateItems(ExchangeService.java:691)
    at microsoft.exchange.webservices.data.core.ExchangeService.updateItem(ExchangeService.java:762)
    at microsoft.exchange.webservices.data.core.service.item.Item.internalUpdate(Item.java:279)
    at microsoft.exchange.webservices.data.core.service.item.Item.update(Item.java:400)
    at be.vrt.quintiqexchange.main.QuintiqAdapter.insertUpdateCalendarItems(QuintiqAdapter.java:880)
    at be.vrt.quintiqexchange.main.QuintiqAdapter.updateCalendarItems(QuintiqAdapter.java:703)
    at be.vrt.quintiqexchange.main.QuintiqAdapter.run(QuintiqAdapter.java:283)
    at java.lang.Thread.run(Thread.java:745)
WARN  be.vrt.quintiqexchange.main.QuintiqAdapter - At least one recipient isn't valid., A message can't be sent because it contains no recipients.by UPDATE for subject:  on Thu Jun 23 14:00:00 CEST 2016 Thu Jun 23 19:00:00 CEST 2016 of user name.lastname@domain.com
INFO  be.vrt.quintiqexchange.main.QuintiqAdapter - Appointment updated for subject: NIET DAG on Fri Aug 05 10:00:00 CEST 2016 Fri Aug 05 18:00:00 CEST 2016 of user name.lastname@domain.com
INFO  be.vrt.quintiqexchange.main.QuintiqAdapter - Appointment updated for subject: PROEF st5 on Mon Aug 22 10:00:00 CEST 2016 Mon Aug 22 20:30:00 CEST 2016 of user name.lastname@domain.com

这意味着收件人不是真正的问题,我想......

P.S。我取代原来的mailaddress但相信我,这是一个正确的mailadres :))

1 个答案:

答案 0 :(得分:0)

在我的情况下,如果地址没有正确修剪并且根本没有任何空格字符,EWS 会吐出这个异常。