zimbra 中的 Zimlets,如何制作简单的 SearchRequest?

Zimlets in zimbra, how to make a simple SearchRequest?

我有点绝望,因为我无法在我的 zimlet 上执行简单的搜索。

我只想在自定义文件夹中进行搜索。

搜索应该只显示我的自定义文件夹中的邮件。

就像我单击左窗格中的自定义文件夹时一样。一模一样

这是显示 html header 的内容,方法是按左窗格中我的自定义文件夹的图标。

{"Header":{"context":{"_jsns":"urn:zimbra","userAgent":{"name":"ZimbraWebClient - FF39 (Linux)","version":"8.6.0_GA_1153"},"session":{"_content":150,"id":150},"account":{"_content":"admin@localhost.local","by":"name"},"csrfToken":"0_a3050edfdf238eadfdfdfdff2f14b4968e3"}},"Body":{"SearchRequest":{"_jsns":"urn:zimbraMail","sortBy":"dateDesc","header":[{"n":"List-ID"},{"n":"X-Zimbra-DL"},{"n":"IN-REPLY-TO"}],"tz":{"id":"America/Mexico_City"},"locale":{"_content":"es_MX"},"offset":0,"limit":100,"query":"in:\"mycustomfolder\"","types":"conversation","recip":"0","fullConversation":1,"needExp":1}}}

我正在 com_zimbra_myzimlet.js

中尝试使用此代码
com_zimbra_myzimlet_HandlerObject.prototype._getShowResultFolderId = 
    function(t) {
    var e=AjxSoapDoc.create("SearchRequest","urn:zimbraMail");
    var cuery="raulicci";
    e.setMethodAttribute("types","conversation");
    e.setMethodAttribute("limit",100);
    e.setMethodAttribute("offset",0);
    e.set("query",cuery);
    t.response=appCtxt.getAppController().sendRequest({
        soapDoc:e,noBusyOverlay:false}
    );
    this.handleSearchResponse(t)
};

到目前为止,我找不到进行咨询的方法,尽管我认为这很容易,因为当用户单击左侧窗格中自定义文件夹中的图标时,就已经在 zimbra 中实现了。

我想使用带有 zimbra 的默认模板来显示收件箱或当前文件夹。

当您单击左侧窗格中当前文件夹的图标时,我们会看到一个电子邮件列表,如收件箱

我正在使用 soap 和 json 使用我的小 zimlet 查询,我回答了一个 JSON 字符串。

此字符串 json 是一个邮件列表,位于您执行查询的文件夹中。

请求使用:

var jsonObj = {SearchRequest:{_jsns:"urn:zimbraMail"}};
var request = jsonObj.SearchRequest;
request.sortBy = "dateDesc";
request.offset = 0;
request.limit = 100;
request.query = 'in:\"MYCURRENTFOLDER\"';
request.types = "conversation";
request.recips = "0";
request.fullConversation = 1;
request.needExp = 1;

var params = {
        jsonObj:jsonObj,
        asyncMode:true,
        callback: (new AjxCallback(this, this._handleSOAPResponseJSON)),
        errorCallback: (new AjxCallback(this, this._handleSOAPErrorResponseJSON)),
};
return appCtxt.getAppController().sendRequest(params);

响应使用:

if (result.isException()) {
    // do something with exception
    var exception = result.getException();      

    return;
}
else {
    response = { _jsns: "urn:zimbraMail", more: false };
}
// do something with response (in JSON format)
var response = result.getResponse();
var name = response.name;
var soapURL = response.publicURL;
var soapURL = response.soapURL;
var aller = result.getResponse();
var searchResult = new ZmSearchResult(this);

appCtxt.setStatusMsg("Response (JSON) success - "+name);
alert(aller.toSource());

JSON响应显示在INBOX集成zimbra的默认模板中

({SearchResponse:{sortBy:"dateDesc", offset:0, c:[{id:"314", u:0, n:2, f:"s", d:1438663876000, su:"lokitox", fr:"lex", e:[{a:"admin@localhost.local", d:"admin", t:"f"}], m:[{id:"313", l:"300"}, {id:"312", l:"5", f:"s"}], sf:"1438663876000"}, {id:"-309", u:0, n:1, d:1438662639000, su:"Daily mail report for 2015-08-03", fr:"Grand Totals -- messages 91 received 117 delivered 0 forwarded 134 deferred (134 deferrals) 169 bounced 0 rejected (0%) 0 reject warnings 0 held 0 ...", e:[{a:"admin@localhost.local", d:"admin", t:"f"}], m:[{id:"309", s:"7232", l:"300"}], sf:"1438662639000"}], more:false, _jsns:"urn:zimbraMail"}})

谢谢,我希望有人知道如何去做