Sample code for 30+ languages & platforms
Lianja

Transition from Imap.FetchChunk to Imap.FetchRange

Provides instructions for replacing deprecated FetchChunk method calls with FetchRange.

Chilkat Lianja Downloads

Lianja
llSuccess = .F.

loImap = createobject("CkImap")

// ...
// ...

lnStartSeqNum = 1
lnCount = 5

loFailedSet = createobject("CkMessageSet")
loFetchedSet = createobject("CkMessageSet")

// ------------------------------------------------------------------------
// The FetchChunk method is deprecated:

loBundleObj = loImap.FetchChunk(lnStartSeqNum,lnCount,loFailedSet,loFetchedSet)
if (loImap.LastMethodSuccess = .F.) then
    ? loImap.LastErrorText
    release loImap
    release loFailedSet
    release loFetchedSet
    return
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.

llHeadersOnly = .F.

loBundleOut = createobject("CkEmailBundle")
llSuccess = loImap.FetchRange(llHeadersOnly,lnStartSeqNum,lnCount,loBundleOut)
if (llSuccess = .F.) then
    ? loImap.LastErrorText
    release loImap
    release loFailedSet
    release loFetchedSet
    release loBundleOut
    return
endif



release loImap
release loFailedSet
release loFetchedSet
release loBundleOut