开发者

Retrieving Mails/Attachements from Exchange Server

开发者 https://www.devze.com 2023-02-15 18:01 出处:网络
I am trying to connect with a mailbox on our exchange server, and I have the servername, username and password.

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?

0

精彩评论

暂无评论...
验证码 换一张
取 消