Sample code for 30+ languages & platforms
Xbase++ Requires Chilkat v11.0.0+

Transition from Imap.Sort to Imap.QueryMbx

Provides instructions for replacing deprecated Sort method calls with QueryMbx.

Chilkat Xbase++ Downloads

Xbase++
LOCAL nSuccess
LOCAL oImap
LOCAL cSearchCriteria
LOCAL nBUid
LOCAL cSortCriteria
LOCAL oMsgSetObj
LOCAL oMset

nSuccess := 0

oImap := CreateObject("Chilkat.Imap")

//  ...
//  ...

cSearchCriteria := "FROM bob@example.com"
nBUid := 1
cSortCriteria := "DATE SUBJECT"

//  ------------------------------------------------------------------------
//  The Sort method is deprecated:

oMsgSetObj := oImap:Sort(cSortCriteria, "UTF-8", cSearchCriteria, nBUid)
IF (oImap:LastMethodSuccess == 0)
    ? oImap:LastErrorText
    oImap:destroy()
    RETURN
ENDIF

//  ...
//  ...

oMsgSetObj:destroy()

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

//  The following properties are used instead of function arguments.
oImap:SortCriteria := "DATE SUBJECT"
oImap:SearchCharset := "UTF-8"

oMset := CreateObject("Chilkat.MessageSet")
nSuccess := oImap:QueryMbx(cSearchCriteria, nBUid, oMset)
IF (nSuccess == 0)
    ? oImap:LastErrorText
    oImap:destroy()
    oMset:destroy()
    RETURN
ENDIF

oImap:destroy()
oMset:destroy()