Solved

C# Connect to Outlook

Posted on 2010-11-23
4
664 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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Use email signature images to promote corporate certifications and industry awards.
Sometimes Outlook might have problems sending a message. There may be various causes- corrupted PST, AV scanner etc. The message, instead of going to the Sent Items folder, sits in the Outbox indefinitely. To remove it you can use a free tool cal…
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 video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

747 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

12 Experts available now in Live!

Get 1:1 Help Now