Retrieving Mails/Attachements from Exchange Server
I am trying to connect with a mailbox on our exchange server, and I have the servername, username and password.
At the moment I have the following code to connect to my personal mailbox and this is working fine:-
app = new Application();
ns = app.GetNamespace("MAPI");
Helpers.AddToErrorLog("CESTOAD mailbox", DateTime.Now.ToString(), "Logging into CESTOAD mailbox");
ns.Logon(user, password, false, false);
inboxFolder = ns.GetDe开发者_如何学PythonfaultFolder(OlDefaultFolders.olFolderInbox);
subFolder = inboxFolder.Folders["ComDocsAttachements"];
However, I cannot find out how to connect to another account with a username and password on the same exchange server. When I change the user and password in the Logon, it still retreives my account.
Can anyone point me in the right direction?
Not sure what library, or API you are using to connect to Exchange, but I would guess that the logon call is still detecting your initial logon, and regarding you as authenticated, and not trying to log you on with the new credentials. Is there a Logoff method you could call first?
精彩评论