none
ews java api 调用接口查找收件箱信息,怎么才能带出附件-attachments RRS feed

  • 问题

  • FindItemsResults<Item> findResults = service.findItems(
    new FolderId("inbox"), 
    view);
    service.loadPropertiesForItems(findResults,new PropertySet(BasePropertySet.IdOnly, ItemSchema.Subject,
           ItemSchema.DateTimeReceived,ItemSchema.DisplayCc,ItemSchema.DisplayTo,
           ItemSchema.Importance,ItemSchema.Attachments,EmailMessageSchema.From));

    我在获取结果集的时候只有ItemSchema.Attachments获取报错,其他都能获取到

    报错信息:

    java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.commons.beanutils.PropertyUtils.getSimpleProperty(PropertyUtils.java:1185)
    at org.apache.commons.beanutils.PropertyUtils.getNestedProperty(PropertyUtils.java:772)
    at org.apache.commons.beanutils.PropertyUtils.getProperty(PropertyUtils.java:801)
    at net.sf.json.JSONObject._fromBean(JSONObject.java:928)
    at net.sf.json.JSONObject.fromObject(JSONObject.java:192)
    at net.sf.json.JSONObject._processValue(JSONObject.java:2774)
    at net.sf.json.JSONObject._setInternal(JSONObject.java:2798)
    at net.sf.json.JSONObject.setValue(JSONObject.java:1507)
    at net.sf.json.JSONObject._fromBean(JSONObject.java:940)
    at net.sf.json.JSONObject.fromObject(JSONObject.java:192)
    at net.sf.json.JSONObject._processValue(JSONObject.java:2774)
    at net.sf.json.JSONObject.processValue(JSONObject.java:2833)
    at net.sf.json.JSONObject.element(JSONObject.java:1871)
    at net.sf.json.JSONObject.element(JSONObject.java:1849)
    at net.sf.json.JSONObject.put(JSONObject.java:2466)
    at cn.com.wavenet.service.util.bean.ews.EWSMailDataBean.getInfo(EWSMailDataBean.java:60)
    at cn.com.wavenet.service.util.bean.ews.EWSItemDataBean.setDataMap(EWSItemDataBean.java:59)
    at cn.com.wavenet.services.action.ews.MSEWSAction.findMailBySearch(MSEWSAction.java:180)
    at cn.com.wavenet.services.action.ews.MSEWSAction.exec(MSEWSAction.java:499)
    at cn.com.wavenet.services.EWSOperImpl.findPagionMailItemBySearch(EWSOperImpl.java:76)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.axis2.rpc.receivers.RPCUtil.invokeServiceClass(RPCUtil.java:212)
    at org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic(RPCMessageReceiver.java:117)
    at org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusinessLogic(AbstractInOutMessageReceiver.java:40)
    at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:110)
    at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:181)
    at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:172)
    at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:146)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
    at java.lang.Thread.run(Thread.java:619)
    Caused by: microsoft.exchange.webservices.data.ServiceObjectPropertyException: You must load or assign this property before you can read its value.
    at microsoft.exchange.webservices.data.PropertyBag.getPropertyValueOrException(Unknown Source)
    at microsoft.exchange.webservices.data.PropertyBag.getObjectFromPropertyDefinition(Unknown Source)
    at microsoft.exchange.webservices.data.Item.getAllowedResponseActions(Unknown Source)
    ... 49 more
    rethrown as net.sf.json.JSONException: java.lang.reflect.InvocationTargetException
    at net.sf.json.JSONObject._fromBean(JSONObject.java:953)
    at net.sf.json.JSONObject.fromObject(JSONObject.java:192)
    at net.sf.json.JSONObject._processValue(JSONObject.java:2774)
    at net.sf.json.JSONObject._setInternal(JSONObject.java:2798)
    at net.sf.json.JSONObject.setValue(JSONObject.java:1507)
    at net.sf.json.JSONObject._fromBean(JSONObject.java:940)
    at net.sf.json.JSONObject.fromObject(JSONObject.java:192)
    at net.sf.json.JSONObject._processValue(JSONObject.java:2774)
    at net.sf.json.JSONObject.processValue(JSONObject.java:2833)
    at net.sf.json.JSONObject.element(JSONObject.java:1871)
    at net.sf.json.JSONObject.element(JSONObject.java:1849)
    at net.sf.json.JSONObject.put(JSONObject.java:2466)
    at cn.com.wavenet.service.util.bean.ews.EWSMailDataBean.getInfo(EWSMailDataBean.java:60)
    at cn.com.wavenet.service.util.bean.ews.EWSItemDataBean.setDataMap(EWSItemDataBean.java:59)
    at cn.com.wavenet.services.action.ews.MSEWSAction.findMailBySearch(MSEWSAction.java:180)
    at cn.com.wavenet.services.action.ews.MSEWSAction.exec(MSEWSAction.java:499)
    at cn.com.wavenet.services.EWSOperImpl.findPagionMailItemBySearch(EWSOperImpl.java:76)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.axis2.rpc.receivers.RPCUtil.invokeServiceClass(RPCUtil.java:212)
    at org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic(RPCMessageReceiver.java:117)
    at org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusinessLogic(AbstractInOutMessageReceiver.java:40)
    at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:110)
    at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:181)
    at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:172)
    at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:146)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
    at java.lang.Thread.run(Thread.java:619)
    Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.commons.beanutils.PropertyUtils.getSimpleProperty(PropertyUtils.java:1185)
    at org.apache.commons.beanutils.PropertyUtils.getNestedProperty(PropertyUtils.java:772)
    at org.apache.commons.beanutils.PropertyUtils.getProperty(PropertyUtils.java:801)
    at net.sf.json.JSONObject._fromBean(JSONObject.java:928)
    ... 41 more

    Caused by: microsoft.exchange.webservices.data.ServiceObjectPropertyException: You must load or assign this property before you can read its value.
    at microsoft.exchange.webservices.data.PropertyBag.getPropertyValueOrException(Unknown Source)
    at microsoft.exchange.webservices.data.PropertyBag.getObjectFromPropertyDefinition(Unknown Source)
    at microsoft.exchange.webservices.data.Item.getAllowedResponseActions(Unknown Source)

    谁能帮忙解决下,谢谢了。。这个资料太少了

    2012年11月20日 8:39

答案