Link to home
Start Free TrialLog in
Avatar of MickyMc
MickyMcFlag for Ireland

asked on

C# Connect to Outlook

Hi all,

I am connecting to outlook using the Interop.Outlook namespace. The issue I have is that no matter what I put in on the login, it still logs me in ahhhh

I have the following code..

            Outlook.Application outlook = new Outlook.ApplicationClass();
            Outlook.NameSpace ns = outlook.GetNamespace("Mapi");

            object _missing = Type.Missing;
            //ns.Logon(_missing, _missing, true, true);
            ns.Logon("UserDoesntExist", "Password", false, true);


            Outlook.MAPIFolder inbox = ns.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox);

            int unread = inbox.UnReadItemCount;

Open in new window


The ns.logon still works. I want to be able to specify the mail server and the user to login as./.. any idea's  thanks M
Avatar of F. Dominicus
F. Dominicus
Flag of Germany image

Avatar of MickyMc

ASKER

thanks Fridom.. good link... actually mentioned the fix for another issue I had but I put in the same fix they had.
I just need to know why the login ignore what I put into the name and password. I would like to specify a server, a username and password to access email boxes... any ideas anyone
ASKER CERTIFIED SOLUTION
Avatar of MickyMc
MickyMc
Flag of Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of MickyMc

ASKER

no help from the experts so had to go figure myself