VBScript
VBScript
Transition from Imap.FetchSingle to Imap.FetchEmail
Provides instructions for replacing deprecated FetchSingle method calls with FetchEmail.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")
' ...
' ...
' ------------------------------------------------------------------------
' The FetchSingle method is deprecated:
' emailObj is a Chilkat.Email
Set emailObj = imap.FetchSingle(1,0)
If (imap.LastMethodSuccess = 0) Then
outFile.WriteLine(imap.LastErrorText)
WScript.Quit
End If
' ...
' ...
' ------------------------------------------------------------------------
' Do the equivalent using FetchEmail.
' Your application creates a new, empty Email object which is passed
' in the last argument and filled upon success.
headerOnly = 0
set email = CreateObject("Chilkat.Email")
success = imap.FetchEmail(headerOnly,1,0,email)
If (success = 0) Then
outFile.WriteLine(imap.LastErrorText)
WScript.Quit
End If
outFile.Close