Solved

C# Connect to Outlook

Posted on 2010-11-23
4
665 Views
Last Modified: 2012-06-27
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
0
Comment
Question by:MickyMc
  • 3
4 Comments
 
LVL 24

Expert Comment

by:fridom
ID: 34203259
0
 

Author Comment

by:MickyMc
ID: 34203410
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
0
 

Accepted Solution

by:
MickyMc earned 0 total points
ID: 34203907
the Login is ignored if there is a instance of outlook running in the background..Duh
0
 

Author Closing Comment

by:MickyMc
ID: 34228542
no help from the experts so had to go figure myself
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Are you unable to connect or configure Hotmail email account in Microsoft Outlook 2010, 2007? Or Outlook.com emails are not downloading to Outlook? Lets’ see the problem and resolve Outlook Connector error syncing folder hierarchy (0x8004102A).
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …

943 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now