Thank you very much for your answer
But I have found another way to do that. I tried to use the zclient api and it seems to be simpler.
Here is how I log in :
Code:
SoapHttpTransport soapHttpTransport = new SoapHttpTransport(SERVICE_URL);
Element request = Element.XMLElement.mFactory.createElement(AccountConstants.AUTH_REQUEST);
request.addAttribute(AccountConstants.E_ACCOUNT, account, Element.Disposition.CONTENT);
request.addAttribute(AccountConstants.E_PASSWORD, password, Element.Disposition.CONTENT);
Element response = soapHttpTransport.invoke(request);
String authToken = response.getAttribute(AccountConstants.E_AUTH_TOKEN);
Options options = new Options(authToken, SERVICE_URL);
ZMailbox zimbraMailbox = new ZMailbox(options);
Then I use the ZMailBox object I just create to execute my queries.
For instance here is the method to get the appointments :
Code:
zimbraMailbox.getApptSummaries(null, start.getTimeInMillis(), end.getTimeInMillis(),
folderIds, TimeZone.getDefault(), null); where start and end are Calendar objects corresponding to the date between which I want to search, and foldersIds a String array containing the ids of the calendars.
And if somebody is interested, here is the code to create an appointment :
Code:
ZMailbox.ZOutgoingMessage message = new ZOutgoingMessage();
message.setSubject("subject");
message.setMessagePart(new MessagePart("text/plain", "message body ..."));
ZInvite invite = new ZInvite();
ZComponent comp = new ZComponent();
comp.setStart(new ZDateTime(startDateInMillis, false, TimeZone.getTimeZone("Europe/Brussels")));
comp.setEnd(new ZDateTime(endDateInMillis, false, TimeZone.getTimeZone("Europe/Brussels")));
comp.setOrganizer(new ZOrganizer(zimbraMailbox.getName()));
comp.setName("name");
invite.getComponents().add(comp);
zimbraMailbox.createAppointment(folderId, null, message, invite, null);