D
Dima Protchenko
Hi,
I am building a windows service, which monitors a mailbox and parses email messages into the db. When I wrote the SAME code in windows forms application, everything worked fine, but I am having a problem in the Windows Service project and I can't figure it out.
For i As Integer = objFolder.Items.Count To 1 Step -1
If TypeOf (objFolder.Items.Item(i)) Is Outlook.MailItem Then
'Me.EventLog.WriteEntry("TechLocatorSRVC", "Sender :" & objMailMessage.SenderName.ToString & ", Message: " & objMailMessage.Body.ToString)
objMailMessage = objFolder.Items.Item(i)
'UpdateLocation(objMailMessage.SenderName.ToString, objMailMessage.Body.ToString)
objMailMessage.UnRead = False
objMailMessage.Move(objArchiveFolder)
End If
Next
Except for the two commented out lines, everything is happening. But as soon as I try to access the MailItem PROPERTIES (like SenderName or Body, commented lines) it seems to abort any kind of execution and doesn't even keep looping. I am doing TRY-CATCH, but it doesn't post any exceptions. I am doing all this on the box with windows XP and office so my project reference is Microsoft Outlook 10.0 Object Library.
Any help is greatly appreciated.
I am building a windows service, which monitors a mailbox and parses email messages into the db. When I wrote the SAME code in windows forms application, everything worked fine, but I am having a problem in the Windows Service project and I can't figure it out.
For i As Integer = objFolder.Items.Count To 1 Step -1
If TypeOf (objFolder.Items.Item(i)) Is Outlook.MailItem Then
'Me.EventLog.WriteEntry("TechLocatorSRVC", "Sender :" & objMailMessage.SenderName.ToString & ", Message: " & objMailMessage.Body.ToString)
objMailMessage = objFolder.Items.Item(i)
'UpdateLocation(objMailMessage.SenderName.ToString, objMailMessage.Body.ToString)
objMailMessage.UnRead = False
objMailMessage.Move(objArchiveFolder)
End If
Next
Except for the two commented out lines, everything is happening. But as soon as I try to access the MailItem PROPERTIES (like SenderName or Body, commented lines) it seems to abort any kind of execution and doesn't even keep looping. I am doing TRY-CATCH, but it doesn't post any exceptions. I am doing all this on the box with windows XP and office so my project reference is Microsoft Outlook 10.0 Object Library.
Any help is greatly appreciated.