(PowerShell) Transition from Imap.FetchSequenceAsMime to Imap.FetchSingleBd
Provides instructions for replacing deprecated FetchSequenceAsMime method calls with FetchSingleBd. Note: This example requires Chilkat v11.0.0 or greater.
Add-Type -Path "C:\chilkat\ChilkatDotNet47-x64\ChilkatDotNet47.dll"
$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
}
|