Results 1 to 6 of 6

Thread: [SOLVED] how do i call the zmprov command in zimlet?

  1. #1
    Join Date
    Sep 2010
    Posts
    14
    Rep Power
    5

    Default [SOLVED] how do i call the zmprov command in zimlet?

    Hello,

    I want to call the zmprov command in zimlet to disable the "save to sent" function temporally, my zmprov command is :

    zmprov ma user@domain.com zimbraPrefSaveToSent FALSE;

    How do i call this command in zimlet?

    Please help.
    Thanks.

  2. #2
    Join Date
    Oct 2009
    Location
    Tokyo
    Posts
    113
    Rep Power
    6

    Default

    Hi chengkinhung,

    zmprov just send SOAP request to Zimbra server.
    So I think, in your zimlet, you better send the same request as zmprov does.

  3. #3
    Join Date
    Sep 2010
    Posts
    14
    Rep Power
    5

    Default

    Thank yutaka,

    I am new in zimbra and zimlet, could you give me a sample code? or any tips how to do it? Thanks again.

  4. #4
    Join Date
    Sep 2005
    Posts
    187
    Rep Power
    10

    Default

    Take a look at Force Read Receipt & Auto-Accept Read Receipt | Zimbra :: Gallery Zimlet. This Zimlet first checks if "zimbraPrefMailSendReadReceipts" property is set to always, if not it sets "zimbraPrefMailSendReadReceipts" to "always".

    <code>
    /**
    * Sets Send read-receipt to "Always"
    */
    ForceReadReceiptZimlet.prototype.setSendReceiptToA lways =
    function() {
    if(appCtxt.getActiveAccount().settings.get("MAIL_S END_READ_RECEIPTS") == "always") {
    return;
    }
    if (appCtxt.get(ZmSetting.MAIL_READ_RECEIPT_ENABLED)) {
    var soapDoc = AjxSoapDoc.create("ModifyPrefsRequest", "urn:zimbraAccount");
    var node = soapDoc.set("pref", "always");
    node.setAttribute("name", "zimbraPrefMailSendReadReceipts");
    var respCallback = new AjxCallback(this, this._handlePrefChangeResponse);
    appCtxt.getAppController().sendRequest({soapDoc:so apDoc, asyncMode:true, callback:respCallback});
    }
    };
    </code>
    Bugzilla - Wiki - Downloads - Before posting... Search!

  5. #5
    Join Date
    Sep 2010
    Posts
    14
    Rep Power
    5

    Default

    Hi, rrao,

    Thanks for you quick helping, i had download the Force Read Receipt & Auto-Accept Read Receipt | Zimbra :: Gallery

    then copy and change code:

    MyMailZimlet.prototype.setSaveToSendFalse =
    function() {
    if(appCtxt.getActiveAccount().settings.get("SAVE_T O_SENT") == FALSE) {
    appCtxt.setStatusMsg("SAVE_TO_SENT: FALSE", ZmStatusView.LEVEL_INFO);
    return;
    }

    if (appCtxt.get(ZmSetting.SAVE_TO_SENT)) {
    var soapDoc = AjxSoapDoc.create("ModifyPrefsRequest", "urn:zimbraAccount");
    var node = soapDoc.set("pref", FALSE);
    node.setAttribute("name", "zimbraPrefSaveToSent");
    var respCallback = new AjxCallback(this, this._handlePrefChangeResponse);
    appCtxt.getAppController().sendRequest({soapDoc:so apDoc, asyncMode:true, callback:respCallback});
    }
    };

    MyMailZimlet.prototype._handlePrefChangeResponse =
    function() {

    But this code is not working, any idea?

  6. #6
    Join Date
    Sep 2010
    Posts
    14
    Rep Power
    5

    Default

    Thank ever body, finially i fixed the problem and the code is working:

    /**
    * Sets SaveToSend to "FALSE"
    */

    MyMailZimlet.prototype.setSaveToSendFalse =
    function() {
    var soapDoc = AjxSoapDoc.create("ModifyPrefsRequest", "urn:zimbraAccount");
    var node = soapDoc.set("pref", "FALSE");
    node.setAttribute("name", "zimbraPrefSaveToSent");
    var respCallback = new AjxCallback(this, this._handlePrefChangeResponse);
    appCtxt.getAppController().sendRequest({soapDoc:so apDoc, asyncMode:false, callback:respCallback});
    };

    /**
    * Sets SaveToSend to "TRUE"
    */
    MyMailZimlet.prototype.setSaveToSendTrue =
    function() {
    var soapDoc = AjxSoapDoc.create("ModifyPrefsRequest", "urn:zimbraAccount");
    var node = soapDoc.set("pref", "TRUE");
    node.setAttribute("name", "zimbraPrefSaveToSent");
    var respCallback = new AjxCallback(this, this._handlePrefChangeResponse);
    appCtxt.getAppController().sendRequest({soapDoc:so apDoc, asyncMode:false, callback:respCallback});
    };

    MyMailZimlet.prototype._handlePrefChangeResponse =
    function() {
    //do nothing as this should happen in the background.
    };

Similar Threads

  1. Replies: 21
    Last Post: 02-04-2010, 09:06 AM
  2. Outlook 2007 Beta error
    By bersrker in forum Zimbra Connector for Outlook
    Replies: 13
    Last Post: 07-17-2008, 07:38 AM
  3. how to call Parlay X Web Services from zimlet
    By Yokomie in forum Zimlets
    Replies: 4
    Last Post: 04-29-2008, 10:10 AM
  4. Replies: 5
    Last Post: 01-11-2008, 04:34 AM
  5. Post instsallation problems
    By Assaf in forum Installation
    Replies: 14
    Last Post: 01-29-2007, 10:38 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
  •