Link to home
Start Free TrialLog in
Avatar of adinas
adinas

asked on

Acessing CDO while program is a service on Win 2000

Hi,

I created a progam that logs onto an Exchange server using CDO 1.21 using the following code:
set CDOSession = new MAPI.Session
CDOSession.Logon "MyProfile",,False,False,0,True

Anyway, it works fine when I run it. But I need to run it as a service. so I used Microsft's tools instsrv.exe and srvany.exe to turn my exe into an NT service. The problem is that now I get a MAPI_E_LOGON_FAILED error whenever I manually start the service.

Anybody know why the logon acts differently when run from a service?

Adin
ASKER CERTIFIED SOLUTION
Avatar of TimCottee
TimCottee
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Guy Hengel [angelIII / a3]
I can confirm that the service will need to run under an NT account, probably YOUR account to have access to the profile information.

CHeers
Avatar of adinas
adinas

ASKER

I tried it using my account too.

In the 'Log On' tab of the service properties I chose 'This account' and used my username and password. I also tried using the admin username and password, in both cases I still got the Logon failed error
Avatar of adinas

ASKER

I tried it using my account too.

In the 'Log On' tab of the service properties I chose 'This account' and used my username and password. I also tried using the admin username and password, in both cases I still got the Logon failed error
I wonder how your program find your profile even you run your program as specific user.

The reason is the system doesn't know how to map your specific user to HKEY_CURRENT_USER
Hi adinas,

could you explain the C grade here?

the guidelines
https://www.experts-exchange.com/jsp/cmtyQuestAnswer.jsp

if there's no further addition then i'll upgrade it to 'A' since the comment seems to answer the question

a bit terse maybe but that's why it was a comment and no answer if you need more help then please ask for it first

Thanks
**JGould-EE Moderator**
Avatar of adinas

ASKER

That is OK with me.
thanks