0

I am trying to connect to my companies Exchange 2003 server using RDO & MAPI which I've never done before. I have found a pretty good site that uses Outlook's Redemption (http://www.dimastr.com/redemption/home.htm) but with all of the examples on the site using VB.NET and me not being great at programming it's a bit difficult to get this working.

So far I have this code

static void ConnectToExchange()
    {
        object oItems;

        //string outLookUser = "My Profile Name";
        string outLookUser = "username@xxx.xxxx";

        string ToEmailAddress = "username@xxxx.com";
        string FromEmailAddress = "username@xxx.com";
        string outLookServer = "xxservernamexx";

        string sMessageBody =
            "\n outLookUser: " + outLookUser +
            "\n outLookServer: " + outLookServer +
            "\n\n";

        RDOSession Session = new RDOSession();
        try
        {                                               

            Session.LogonExchangeMailbox(outLookUser,outLookServer);
            int mailboxCount = Session.Stores.Count;
            string defaultStore = Session.Stores.DefaultStore.Name;

            RDOFolder TestTaxCert = Session.GetFolderFromPath(@"\\Public Folders\All Public Folders\TestTaxCert");


        }
        catch (Exception ex)
        {
            Session = null;

            //System.Web.Mail.SmtpMail.Send(ToEmailAddress, FromEmailAddress, "Error", sMessageBody + " " + ex.Message);

        }
        finally
        {
            if ((Session != null))
            {
                if (Session.LoggedOn)
                {
                    Session.Logoff();
                }
            }
        }

    }
}

My problem is that once the program hits the Session.LogonExchangeMailbox(outLookUser,outLookServer); line, a prompt appears asking for my credentials (username, domain, password) and no matter what information I fed the prompt it denied permission.

SO if someone can help me with that and then also with connecting to the public folders...that'd be greaaat

MaylorTaylor
  • 4,671
  • 16
  • 47
  • 76

1 Answers1

0

Make sure your code is running as the domain user specified in the call to LogonExchangeMailbox. Did you really mean 2003, or is it Exchange 2013?

Dmitry Streblechenko
  • 62,942
  • 4
  • 53
  • 78
  • I really meant Exchange 2003. I've read that there are a number of issues connecting to this b/c it was written for C++ and has very little .NET support. – MaylorTaylor Jul 16 '13 at 22:51
  • Exchange 2003 is perfectly fine. It really does not care that you are calling it from a .Net code. – Dmitry Streblechenko Jul 17 '13 at 16:40
  • How do I make sure my code is running as the domain user i'm using in the LogonExchangeMailbox method? – MaylorTaylor Jul 17 '13 at 17:36
  • You need to log locally to your machine as the domain user who owns the mailbox. In case of a service, you can specify the user identity on the Log On tab in the service properties dialog. – Dmitry Streblechenko Jul 17 '13 at 17:43