Creating a service to connect to Outlook 2003

ardman

Newcomer
Joined
Jul 19, 2005
Messages
11
Hi,
I'm creating a service that connects to Outlook 2003. I'm getting a problem when I start the service and it tries to connect to the Exchange Server. When I debug it, it works everytime. When I start it as a service, it fails every time. I know that the code is correct as it lets me connect when debugging.

Please can anyone help or at least shed some light on this?
 
PlausiblyDamp said:
What user account is the service running as? Does this account have access to the Exchange server?

I'm using my own log in which has an Exchange Account. It is connecting correctly to the account and even works when I try and debug it, but it seems to fail when it tries to get the sender email address.

Visual Basic:
Private objMessage As Outlook.MailItem

Public Sub ProcessEmails()
[indent]objMessage = objFolder.Items(1)[/indent]
[indent]'Get the sender email address[/indent]
[indent]Dim strSender As String = objMessage.SenderEmailAddress[/indent]
[indent]'rest of the sub ....[/indent]
End Sub

It fails on the Dim strSender line. It sets the message object correctly, but as soon as it does anything else with objMessage it fails completely. Any ideas?
 
Back
Top