Sample code for 30+ languages & platforms
Node.js

Transition from Imap.ThreadCmd to Imap.QueryThread

Provides instructions for replacing deprecated ThreadCmd method calls with QueryThread.

Chilkat Node.js Downloads

Node.js
NODEJS_PRELUDE

function chilkatExample() {

    var success = false;

    var imap = new chilkat.Imap();

    //  ...
    //  ...

    var threadAlg = "REFERENCES";
    var charset = "UTF-8";
    var searchCriteria = "SUBJECT a";
    var bUid = true;

    //  ------------------------------------------------------------------------
    //  The ThreadCmd method is deprecated:

    // jsonObj: JsonObject
    var jsonObj = imap.ThreadCmd(threadAlg,charset,searchCriteria,bUid);
    if (imap.LastMethodSuccess == false) {
        console.log(imap.LastErrorText);
        return;
    }

    //  ...
    //  ...

    //  ------------------------------------------------------------------------
    //  Do the equivalent using QueryThread.
    //  Your application creates a new, empty JsonObject object which is passed 
    //  in the last argument and filled upon success.

    imap.SearchCharset = "UTF-8";

    var json = new chilkat.JsonObject();
    success = imap.QueryThread(threadAlg,searchCriteria,bUid,json);
    if (success == false) {
        console.log(imap.LastErrorText);
        return;
    }


}

chilkatExample();