Sample code for 30+ languages & platforms
DataFlex

Transition from Imap.FetchSequence to Imap.FetchRange

Provides instructions for replacing deprecated FetchSequence method calls with FetchRange.

Chilkat DataFlex Downloads

DataFlex
Use ChilkatAx-win32.pkg

Procedure Test
    Boolean iSuccess
    Handle hoImap
    Integer iStartSeqNum
    Integer iCount
    Variant vBundleObj
    Handle hoBundleObj
    Boolean iHeadersOnly
    Variant vBundleOut
    Handle hoBundleOut
    String sTemp1
    Boolean bTemp1

    Move False To iSuccess

    Get Create (RefClass(cComChilkatImap)) To hoImap
    If (Not(IsComObjectCreated(hoImap))) Begin
        Send CreateComObject of hoImap
    End

    // ...
    // ...

    Move 1 To iStartSeqNum
    Move 5 To iCount

    // ------------------------------------------------------------------------
    // The FetchSequence method is deprecated:

    Get ComFetchSequence Of hoImap iStartSeqNum iCount To vBundleObj
    If (IsComObject(vBundleObj)) Begin
        Get Create (RefClass(cComChilkatEmailBundle)) To hoBundleObj
        Set pvComObject Of hoBundleObj To vBundleObj
    End
    Get ComLastMethodSuccess Of hoImap To bTemp1
    If (bTemp1 = False) Begin
        Get ComLastErrorText Of hoImap To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    // ...
    // ...

    Send Destroy of hoBundleObj

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

    Move False To iHeadersOnly

    Get Create (RefClass(cComChilkatEmailBundle)) To hoBundleOut
    If (Not(IsComObjectCreated(hoBundleOut))) Begin
        Send CreateComObject of hoBundleOut
    End
    Get pvComObject of hoBundleOut to vBundleOut
    Get ComFetchRange Of hoImap iHeadersOnly iStartSeqNum iCount vBundleOut To iSuccess
    If (iSuccess = False) Begin
        Get ComLastErrorText Of hoImap To sTemp1
        Showln sTemp1
        Procedure_Return
    End



End_Procedure