Solved

C# Connect to Outlook

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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

Following basic email etiquette rules will help you write a professional email and achieve a good, lasting impression with your contacts.
MS Outlook is a world-class email client application that is mainly used for e-communication globally.  In this article, we will discuss the basic idea about MS Outlook, its advanced features, and types of MS Outlook File formats.
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: …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

786 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