Sample code for 30+ languages & platforms
Visual FoxPro

Transition from Imap.FetchHeaders to Imap.FetchMsgSet

Provides instructions for replacing deprecated FetchHeaders method calls with FetchMsgSet.

Chilkat Visual FoxPro Downloads

Visual FoxPro
LOCAL lnSuccess
LOCAL loImap
LOCAL loMset
LOCAL loBundleObj
LOCAL lnHeadersOnly
LOCAL loBundleOut

lnSuccess = 0

loImap = CreateObject('Chilkat.Imap')

* ...
* ...

loMset = CreateObject('Chilkat.MessageSet')
lnSuccess = loImap.QueryMbx("FROM joe@example.com",1,loMset)
* ...
* ...

* ------------------------------------------------------------------------
* The FetchHeaders method is deprecated:

loBundleObj = loImap.FetchHeaders(loMset)
IF (loImap.LastMethodSuccess = 0) THEN
    ? loImap.LastErrorText
    RELEASE loImap
    RELEASE loMset
    CANCEL
ENDIF

* ...
* ...

RELEASE loBundleObj

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

lnHeadersOnly = 1

loBundleOut = CreateObject('Chilkat.EmailBundle')
lnSuccess = loImap.FetchMsgSet(lnHeadersOnly,loMset,loBundleOut)
IF (lnSuccess = 0) THEN
    ? loImap.LastErrorText
    RELEASE loImap
    RELEASE loMset
    RELEASE loBundleOut
    CANCEL
ENDIF

RELEASE loImap
RELEASE loMset
RELEASE loBundleOut