Sample code for 30+ languages & platforms
PowerShell Requires Chilkat v11.0.0+

Transition from Imap.FetchSequenceAsMime to Imap.FetchSingleBd

Provides instructions for replacing deprecated FetchSequenceAsMime method calls with FetchSingleBd.

Chilkat PowerShell Downloads

PowerShell
Add-Type -Path "C:\chilkat\ChilkatDotNet47-x64\ChilkatDotNet47.dll"

$success = $false

$imap = New-Object Chilkat.Imap

#  ...
#  ...

$startSeqNum = 1
$count = 5

#  ------------------------------------------------------------------------
#  The FetchSequenceAsMime method is deprecated:

$sa = $imap.FetchSequenceAsMime($startSeqNum,$count)
if ($imap.LastMethodSuccess -eq $false) {
    $($imap.LastErrorText)
    exit
}

#  ...
#  ...

#  ------------------------------------------------------------------------
#  Do the equivalent using FetchSingleBd.

$imap.AutoDownloadAttachments = $true

$success = $false
$bdMime = New-Object Chilkat.BinData
$bUid = $false
$i = 0
while ($i -lt $count) {
    $success = $imap.FetchSingleBd($startSeqNum + $i,$bUid,$bdMime)
    #  ...
    #  ...

    $i = $i + 1
}