How do I initialize MAPI Properly for a Console Application which runs from Scheduled Task.
- From: "Russell Mangel" <russell@xxxxxxxxx>
- Date: Fri, 10 Mar 2006 19:14:57 -0800
Hi,
I found a MS KB article that show how to run a MAPI program as a service.
However, my program is not a service it is simply a "console application" I
wish to schedule the program using Windows scheduled tasks and it will run
once per day.
Can someone look over the flags I have set? I don't know if I have these
right.
I will be setting a Username and Password in the task so this means I
shouldn't need any impersonation. So when the Console application gets
executed by windows it should use the Username and Password I entered when I
configured the task right?
Thanks
Russell Mangel
// Begin code
HRESULT hr = NULL;
ULONG ulFlags = 0;
MAPIINIT_0 pMapiInit = { MAPI_INIT_VERSION, MAPI_NT_SERVICE };
hr = MAPIInitialize(&pMapiInit);
if(FAILED(hr)){printf("MAPIInitialize failed\n");goto CleanUp;}
ulFlags =
MAPI_NO_MAIL|MAPI_NEW_SESSION|MAPI_EXPLICIT_PROFILE|MAPI_NT_SERVICE ;
LPMAPISESSION lpSession = NULL;
hr = MAPILogonEx(0,lpszProfileName,NULL,ulFlags,&lpSession);
if(FAILED(hr)){printf("MAPILogonEx failed.\n");goto CleanUp;}
.
- Follow-Ups:
- Re: How do I initialize MAPI Properly for a Console Application which runs from Scheduled Task.
- From: Dmitry Streblechenko
- Re: How do I initialize MAPI Properly for a Console Application which runs from Scheduled Task.
- Prev by Date: Re: SendMail event in Outlook directly from MAPI
- Next by Date: Re: How do I initialize MAPI Properly for a Console Application which runs from Scheduled Task.
- Previous by thread: Getting CDO IMessage Errors
- Next by thread: Re: How do I initialize MAPI Properly for a Console Application which runs from Scheduled Task.
- Index(es):
Relevant Pages
|
Loading