H
harischristou
Hello,
I have written a simple service in VB.NET that utlizes outlook
redemption to connect to an exchange server and scan emails. This code
constantly loops so that any new mails received are also scanned. I
have included a sample of the code below.
However each time I call the following line:
Session.LogonExchangeMailbox("(e-mail address removed)",
"myexchangeserver")
a new file is written to the users temp directory called something
like: ExchangePerflog_7474fa31e83746e8bfc73df3.dat
Although these files arent that big they eventually build up and start
taking up a considerable amount of HDD space. The files also remain
behind when I log off from the exchange server and set the session to
nothing.
Any help would be really appreciated..
Thanks
Harry
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button1.Click
Do
CheckExchangeEmail()
Loop
End Sub
Private Sub CheckExchangeEmail()
Const olFolderInbox As Redemption.rdoDefaultFolders = 6
Dim Session As New Redemption.RDOSession
Dim objFolder As Redemption.RDOFolder
Dim oItems As Object
Dim oItem As Redemption.RDOMail
Dim sMessageBody As String
Try
'This is the line that prompts me for login credentials
Session.LogonExchangeMailbox("(e-mail address removed)",
"myexchangeserver")
objFolder = Session.GetDefaultFolder(olFolderInbox)
oItems = objFolder.Items
For Each oItem In oItems
sMessageBody = oItem.Body
MsgBox(sMessageBody)
Next
Catch ex As Exception
Session = Nothing
Finally
If Not IsNothing(Session) Then
If Session.LoggedOn Then
Session.Logoff()
End If
End If
End Try
End Sub
End Class
I have written a simple service in VB.NET that utlizes outlook
redemption to connect to an exchange server and scan emails. This code
constantly loops so that any new mails received are also scanned. I
have included a sample of the code below.
However each time I call the following line:
Session.LogonExchangeMailbox("(e-mail address removed)",
"myexchangeserver")
a new file is written to the users temp directory called something
like: ExchangePerflog_7474fa31e83746e8bfc73df3.dat
Although these files arent that big they eventually build up and start
taking up a considerable amount of HDD space. The files also remain
behind when I log off from the exchange server and set the session to
nothing.
Any help would be really appreciated..
Thanks
Harry
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button1.Click
Do
CheckExchangeEmail()
Loop
End Sub
Private Sub CheckExchangeEmail()
Const olFolderInbox As Redemption.rdoDefaultFolders = 6
Dim Session As New Redemption.RDOSession
Dim objFolder As Redemption.RDOFolder
Dim oItems As Object
Dim oItem As Redemption.RDOMail
Dim sMessageBody As String
Try
'This is the line that prompts me for login credentials
Session.LogonExchangeMailbox("(e-mail address removed)",
"myexchangeserver")
objFolder = Session.GetDefaultFolder(olFolderInbox)
oItems = objFolder.Items
For Each oItem In oItems
sMessageBody = oItem.Body
MsgBox(sMessageBody)
Next
Catch ex As Exception
Session = Nothing
Finally
If Not IsNothing(Session) Then
If Session.LoggedOn Then
Session.Logoff()
End If
End If
End Try
End Sub
End Class