/** * Get an AppointmentItem using soap * * @param account * @param query * @param start * @param end * @return * @throws HarnessException */ public static AppointmentItem importFromSOAP( ZimbraAccount account, String query, ZDate start, ZDate end) throws HarnessException { try { account.soapSend( "<SearchRequest xmlns='urn:zimbraMail' types='appointment' calExpandInstStart='" + start.toMillis() + "' calExpandInstEnd='" + end.toMillis() + "'>" + "<query>" + query + "</query>" + "</SearchRequest>"); Element[] results = account.soapSelectNodes("//mail:SearchResponse/mail:appt"); if (results.length != 1) // throw new HarnessException("Query should return 1 result, not "+ results.length); return null; String id = account.soapSelectValue("//mail:appt", "id"); account.soapSend( "<GetAppointmentRequest xmlns='urn:zimbraMail' id='" + id + "' includeContent='1'>" + "</GetAppointmentRequest>"); Element getAppointmentResponse = account.soapSelectNode("//mail:GetAppointmentResponse", 1); // Using the response, create this item return (importFromSOAP(getAppointmentResponse)); } catch (Exception e) { throw new HarnessException( "Unable to import using SOAP query(" + query + ") and account(" + account.EmailAddress + ")", e); } }