
Outlook Automation and CDO
I am developing an Access application that reads and processes
incoming emails. The application needs to automatically log on to
Outlook under a different profile and password, do its processing, and
then log off. I am able to log on under a different profile using the
following CDO logon:
Dim oSession as MAPI.Session
Set oSession = CreateObject("MAPI.Session")
oSession.logon ProfileName:="DifferentProfile", _
ProfilePassword:="DifferentPassword", _
ShowDialog:=True, _
NewSession:=False
This code displays the logon dialog box where I enter the password and
I'm in. The problem occurs when I set the ShowDialog parameter to
False. I can't log on to the session then. It's acting as if it's
ignoring the Password parameter. The code needs to run automatically
without user intervention so leaving the ShowDialog parameter set to
True is not an option. So how can I log on to Outlook automatically
(using CDO) with a different profile and password?