(Unicode C++) Transition from Imap.FetchSingle to Imap.FetchEmail
Provides instructions for replacing deprecated FetchSingle method calls with FetchEmail. Note: This example requires Chilkat v11.0.0 or greater.
#include <CkImapW.h>
#include <CkEmailW.h>
void ChilkatSample(void)
{
CkImapW imap;
// ...
// ...
// ------------------------------------------------------------------------
// The FetchSingle method is deprecated:
CkEmailW *emailObj = imap.FetchSingle(1,false);
if (imap.get_LastMethodSuccess() == false) {
wprintf(L"%s\n",imap.lastErrorText());
return;
}
// ...
// ...
delete emailObj;
// ------------------------------------------------------------------------
// Do the equivalent using FetchEmail.
// Your application creates a new, empty Email object which is passed
// in the last argument and filled upon success.
bool headerOnly = false;
CkEmailW email;
bool success = imap.FetchEmail(headerOnly,1,false,email);
if (success == false) {
wprintf(L"%s\n",imap.lastErrorText());
return;
}
}
|