locked
C++ email using CDO/Mapi in a NT Service RRS feed

  • Question

  • Hi,

    I'm trying to get some Exchange Server email support inside a c++ Win32 NT Service.

    Using CDO as follows:

    #import <cdo.dll> no_namespace rename("Folder", "newFolder") rename( "GetMessage", "newGetMessage")


    I do the usual

    CoInitializeEx(NULL,COINIT_MULTITHREADED);
    // email stuff....
    CoUninitialize();

    The problem is with the old email stuff when I get to Logon, namely...

    _SessionPtr pSession("MAPI.Session");  // Work 100% fine
    pSession->Logon( "Server" ); // Error

    At this line I get a 'Type mismatch' error.

    If I supply an invalid profile, I logicalyy get a 'MAPI_E_LOGON_FAILED(80040111)]' error as expected.

    Any help would be appreciated.

    I rember reading that one should use 'MAPI_NT_SERVICE' when initialising for use in a service, but where I do this, I know not!

    Regards..........Adrian

    Wednesday, October 19, 2005 12:24 PM

Answers

All replies