Sample code for 30+ languages & platforms
Visual FoxPro

Transition from Imap.Sort to Imap.QueryMbx

Provides instructions for replacing deprecated Sort method calls with QueryMbx.

Chilkat Visual FoxPro Downloads

Visual FoxPro
LOCAL lnSuccess
LOCAL loImap
LOCAL lcSearchCriteria
LOCAL lnBUid
LOCAL lcSortCriteria
LOCAL loMsgSetObj
LOCAL loMset

lnSuccess = 0

loImap = CreateObject('Chilkat.Imap')

* ...
* ...

lcSearchCriteria = "FROM bob@example.com"
lnBUid = 1
lcSortCriteria = "DATE SUBJECT"

* ------------------------------------------------------------------------
* The Sort method is deprecated:

loMsgSetObj = loImap.Sort(lcSortCriteria,"UTF-8",lcSearchCriteria,lnBUid)
IF (loImap.LastMethodSuccess = 0) THEN
    ? loImap.LastErrorText
    RELEASE loImap
    CANCEL
ENDIF

* ...
* ...

RELEASE loMsgSetObj

* ------------------------------------------------------------------------
* 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.
loImap.SortCriteria = "DATE SUBJECT"
loImap.SearchCharset = "UTF-8"

loMset = CreateObject('Chilkat.MessageSet')
lnSuccess = loImap.QueryMbx(lcSearchCriteria,lnBUid,loMset)
IF (lnSuccess = 0) THEN
    ? loImap.LastErrorText
    RELEASE loImap
    RELEASE loMset
    CANCEL
ENDIF

RELEASE loImap
RELEASE loMset