How to create a new calendar using classes in package com.zimbra.cs.zclient
I am just looking at the package com.zimbra.cs.zclient in the ZimbraServer 5.0 sources and was wondering, if there is a way to create a new calendar using any of the classes in this package.
Does anyone know how you can create a new calendar via SOAP and the zclient classes?
Calendars are folders in Zimbra
After analysing the communication between the client and the server, when I was creating a calendar, I found out that calendars are nothing else than folders with the "appointment" view in Zimbra. Here is the XML I captured during a create calendar request:
So I have now created some code not using some other classes I found in the Zimbra distribution which creates successfully the calendar:
<userAgent name="ZimbraWebClient - FF2.0 (Win)" version="5.0.1_GA_1902.RHEL4"/>
<folder l="1" name="test3" color="1" f="#" view="appointment"/>
* Creates calendar resource via SOAP.
* @param name The name of the calendar.
* @return The calendar identifier.
* @throws ServiceException Thrown in case that the service does not work.
* @throws IOException Thrown in case the communication with the server fails.
* @throws LmcSoapClientException
* @throws SoapParseException Thrown in case the SOAP request cannot be parsed.
public String createCalendar(String name)
throws ServiceException, SoapParseException, LmcSoapClientException, IOException
LOG.info("==== CREATE CALENDAR ======");
LmcCreateFolderRequest cfReq = new LmcCreateFolderRequest();
cfReq.setSession(session);// this is LmcSession
cfReq.setView(APPOINTMENT); // "appointment"
cfReq.setParentID(this.getRootFolder().getFolderID()); // The root folder identifier for the user that is logged in.
LmcCreateFolderResponse cfResp = (LmcCreateFolderResponse) cfReq.invoke(serverURL);
String newID = cfResp.getFolder().getFolderID();
LOG.info("created new folder with ID " + newID);
Thank you very much for your reply
Thank you very much for your reply :D.