I am experimenting with a small program for e-mail from an Exchange server and save any attachments. From the suggestions, I decided to use the Redemption library.
I installed the Microsoft Exchange Server MAPI Client and Collaboration Data Objects 1.2.1 on the server so that it works without Outlook. When I run the program on my local machine, it can easily view my own mailboxes. However, when I try to execute it on the server, I have problems.
I get an invitation to enter, even if I provided the information to enter the code. I am registered on the server with a different account than the one I am trying to access. My easiest attempt is something like:
// Get session RDOSession session = RedemptionLoader.new_RDOSession(); // Attempt login session.Credentials.Add("outlook.server.local", "user", "password", rdoCredentialType.ctGeneric, rdoCredentialPersist.cpLocalMachine); session.LogonExchangeMailboxEx("user", "outlook.server.local", false, true, "", ""); // Access mailbox RDOFolder folder = session.GetDefaultFolder(rdoDefaultFolders.olFolderInbox);
I get an error when trying to access a mailbox or any other item:
Unhandled Exception: System.Runtime.InteropServices.COMException: Error in IMAPI Session::OpenMsgStore: MAPI_E_LOGON_FAILED Make sure your code runs under the Windows user identity that has MAPI profiles.
How can I access my mailbox even when logging in as another user? If I launched the program using "Run as ..." and provided my login to enter the system, it will also work on the server. But I need it to work with different users.
source share