VBScript
VBScript
Transition from Imap.FetchBundleAsMime to Imap.FetchSingleBd
Provides instructions for replacing deprecated FetchBundleAsMime method calls with FetchSingleBd.Chilkat VBScript Downloads
Dim fso, outFile
Set fso = CreateObject("Scripting.FileSystemObject")
'Create a Unicode (utf-16) output text file.
Set outFile = fso.CreateTextFile("output.txt", True, True)
success = 0
set imap = CreateObject("Chilkat.Imap")
' ...
' ...
set mset = CreateObject("Chilkat.MessageSet")
success = imap.QueryMbx("FROM joe@example.com",1,mset)
' ...
' ...
' ------------------------------------------------------------------------
' The FetchBundleAsMime method is deprecated:
' saObj is a Chilkat.StringArray
Set saObj = imap.FetchBundleAsMime(mset)
If (imap.LastMethodSuccess = 0) Then
outFile.WriteLine(imap.LastErrorText)
WScript.Quit
End If
' ...
' ...
' ------------------------------------------------------------------------
' Do the equivalent using FetchSingleBd.
imap.AutoDownloadAttachments = 1
set bdMime = CreateObject("Chilkat.BinData")
bUid = mset.HasUids
numEmails = mset.Count
i = 0
Do While i < numEmails
success = imap.FetchSingleBd(mset.GetId(i),bUid,bdMime)
' ...
' ...
i = i + 1
Loop
outFile.Close