repressing promts when using LogonExchangeMailbox




I am trying to write a simple program in VB.NET that connects an
outlook exchange server and reads through the emails of a specific
user account. However as I need this code to run in the background it
cannot prompt the user for any login credentials.

I have written the following which seems to work well with the
exception of prompting the user for their username and password..
which I cannot seem to get rid of... please help!!! :)

BTW - this code utlizes outlook redemption so to avoid security
messages being displayed.

You can assume that the login credentials are known (say L:
(e-mail address removed) P:password123)

Imports Redemption
Imports MSMAPI

Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button1.Click
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


'This is the line that prompts me for login credentials
Session.LogonExchangeMailbox("(e-mail address removed)",

objFolder = Session.GetDefaultFolder(olFolderInbox)
oItems = objFolder.Items

For Each oItem In oItems
sMessageBody = oItem.Body

Catch ex As Exception
Session = Nothing
If Not IsNothing(Session) Then
If Session.LoggedOn Then
End If
End If
End Try

End Sub

End Class

Ken Slovak - [MVP - Outlook]

Then the code has to be running under the Windows identity of a user who has
permissions to log into that mailbox. Otherwise you get the prompts.

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question