Sample code for 30+ languages & platforms
Visual FoxPro

Transition from Imap.FetchChunk to Imap.FetchRange

Provides instructions for replacing deprecated FetchChunk method calls with FetchRange.

Chilkat Visual FoxPro Downloads

Visual FoxPro
LOCAL lnSuccess
LOCAL loImap
LOCAL lnStartSeqNum
LOCAL lnCount
LOCAL loFailedSet
LOCAL loFetchedSet
LOCAL loBundleObj
LOCAL lnHeadersOnly
LOCAL loBundleOut

lnSuccess = 0

loImap = CreateObject('Chilkat.Imap')

* ...
* ...

lnStartSeqNum = 1
lnCount = 5

loFailedSet = CreateObject('Chilkat.MessageSet')
loFetchedSet = CreateObject('Chilkat.MessageSet')

* ------------------------------------------------------------------------
* The FetchChunk method is deprecated:

loBundleObj = loImap.FetchChunk(lnStartSeqNum,lnCount,loFailedSet,loFetchedSet)
IF (loImap.LastMethodSuccess = 0) THEN
    ? loImap.LastErrorText
    RELEASE loImap
    RELEASE loFailedSet
    RELEASE loFetchedSet
    CANCEL
ENDIF

* ...
* ...

RELEASE loBundleObj

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

lnHeadersOnly = 0

loBundleOut = CreateObject('Chilkat.EmailBundle')
lnSuccess = loImap.FetchRange(lnHeadersOnly,lnStartSeqNum,lnCount,loBundleOut)
IF (lnSuccess = 0) THEN
    ? loImap.LastErrorText
    RELEASE loImap
    RELEASE loFailedSet
    RELEASE loFetchedSet
    RELEASE loBundleOut
    CANCEL
ENDIF

RELEASE loImap
RELEASE loFailedSet
RELEASE loFetchedSet
RELEASE loBundleOut