Results 1 to 2 of 2

Thread: create Appt

  1. #1
    Join Date
    Apr 2011
    Rep Power

    Default create Appt

    Hello, I want create new appointement in calendar.I have see a function createappt in evite zimlet. But I want add participant's and choose calendar(I think change this.eviteFolderID)... How can I process?

    Evite | Zimbra :: Gallery

     * Creates soap request to create an appointment in Evite-calendar folder
     * @param {string} title  		the appointment subject
     * @param {string} url			the Evite url
     * @param {date} date 			the date of the appointment
     * @param {string} time			the time of the appointment
    EviteZimlet.prototype._createAppt =
    function(title, url, date, time) {
    	if (!this.userID || !this.eviteFolderID) {
    		appCtxt.getAppController().setStatusMsg(this.getMessage("EviteZimlet_NotInitialized"), ZmStatusView.LEVEL_CRITICAL);
    	var soapDoc = AjxSoapDoc.create("CreateAppointmentRequest", "urn:zimbraMail");
    	var m = soapDoc.set("m");
    	m.setAttribute("l", this.eviteFolderID);
    	var node = soapDoc.set("inv", null, m);
    	node.setAttribute("method", "REQUEST");
    	node.setAttribute("type", "event");
    	node.setAttribute("fb", "B");
    	node.setAttribute("transp", "O");
    	node.setAttribute("status", "CONF");
    	node.setAttribute("allDay", "1");
    	node.setAttribute("name", title);
    	node.setAttribute("loc", "");
    	var subnode = soapDoc.set("s", null, node);
    	subnode.setAttribute("d", date);
    	subnode = soapDoc.set("e", null, node);
    	subnode.setAttribute("d", date);
    	subnode = soapDoc.set("or", null, node);
    	subnode.setAttribute("a", this._getUsername());
    	node = soapDoc.set("mp", null, m);
    	node.setAttribute("ct", "text/plain");
    	subnode = soapDoc.set("content", url, node);
    	node = soapDoc.set("su", title, m);
    	var command = new ZmCsfeCommand();
    	var resp = command.invoke({soapDoc: soapDoc});
    Regards... Rémi

  2. #2
    Join Date
    Jul 2012
    Rep Power



    You can set attendees by adding an at(tendee) element to your /m/inv/comp element (so it should be /m/inv/comp/at). See documentation of the SOAP API here for what attributes and content to set inside this element : Zimbra SOAP API Reference 8.0.0_GA_5424

    Also, if you want to change the folder, you have to change the "l" attribute of your message (m).

    Hope that helps. The API documentation may seem a little hieroglyphic/cryptic, but if you look at it 3 or more times you get accustomed to its layout. Not all elements and attributes are necessary of course.

    What I did is take a look at the SOAP message create by Zimbra itself when I manually added an appointement, the XML looked like this :

    <soap:Envelope xmlns:soap="">
    		<context xmlns="urn:zimbra">
    			<userAgent xmlns="" name="ZimbraWebClient - FF3.0 (Win)" version="7.2.1 GA"/>
    			<session xmlns="" id="16"/>
    			<account xmlns="" by="name"></account>
    			<format xmlns="" type="js"/>
    		<CreateAppointmentRequest xmlns="urn:zimbraMail">
    			<m xmlns="" l="57f6a117-cf46-41d8-8956-a38d06c8cd1e:10">
    					<comp status="CONF" fb="B" class="PUB" transp="O" draft="0" allDay="0" name="test" loc="">
    						<s tz="Europe/Berlin" d="20121016T083000"/>
    						<e tz="Europe/Berlin" d="20121016T090000"/>
    						<or a="" d="Yassine Chaouche"/>
    						<alarm action="DISPLAY">
    								<rel m="5" related="START" neg="1"/>
    				<e a="" t="f"/>
    				<mp ct="multipart/alternative">
    					<mp ct="text/plain">
    					<mp ct="text/html">
    I took the elements that mattered to me and put them inside my javascript code (also, you can construct your SOAP request out of pure javascript, no XML, see below) :

    AppointmentZimlet.prototype.az_create_appointment = function(){
    // <CreateAppointmentRequest xmlns="urn:zimbraMail">
    // 	<m xmlns="" l="57f6a117-cf46-41d8-8956-a38d06c8cd1e:10">
    // 		<inv>...</inv>
    // 		<e a="" t="f"/>
    // 		<su>test</su>
    // 		<mp ct="multipart/alternative">...</mp>		
    // 	</m>
    // </CreateAppointmentRequest>
        var component  = {
    	status : "CONF",
    	fb     : "B",
    	class  : "PUB",
    	allDay : 0,
    	name   : "Test",
    	loc    : "Somewhere, beyond the sea",
    	s      : {d:"20121016T083000"},
    	e      : {d:"20121016T090000"},
    	or     : {a:"", d:"yassine chaouche mon pote"}
        var invitation = {comp : component};
        var message    = {inv:invitation,e:"",su:"LE SUJET DU JOUR EST : LA CREVETTE AUX CHAMPIGNONS NOIRS"};
        jsonObj = {
    	CreateAppointmentRequest : {
        return appCtxt.getAppController().sendRequest({jsonObj:jsonObj, asyncMode:true, callback:new AjxCallback(this,this.az_create_appointment_cb)});
    To my big surprise, this code worked the very first time. It happens very, very rarely to me.
    Last edited by ychaouche; 10-14-2012 at 08:08 AM. Reason: worked first time

Similar Threads

  1. 5.01 GA Create certificate ?
    By woeper in forum Installation
    Replies: 1
    Last Post: 01-25-2008, 12:05 AM
  2. Various errors during install and initial startup
    By theschles in forum Installation Help
    Replies: 2
    Last Post: 11-21-2007, 02:51 PM
  3. unable to create inexistent folder
    By dhain in forum Developers
    Replies: 2
    Last Post: 07-16-2007, 12:27 PM
  4. Fedora 5: Could not create the Java virtual machine
    By mi2enno in forum Installation
    Replies: 6
    Last Post: 06-01-2007, 04:16 AM
  5. Opensource backup Question.
    By nfear24 in forum Administrators
    Replies: 3
    Last Post: 04-01-2007, 12:47 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts