1

I'm Developing a Console Application for testing purpose in C#. This Application is made to read the Email from MS Exchange Web Service server2007. But I can't get it working for a while. should I include some code in the App.config? which one! here is this exception

AutodiscoverLovalException

Even I make use of configurattion.appSettings() to pass the key and the value, Still getting the same handler. this really frustrate a lot.

Here is my tested code:

 static void Main(string[] args)
    {
        // Create the binding.
        ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2007_SP1);
        service.Credentials = new WebCredentials("user", "pass", "domain");

        // Set the URL.
        service.AutodiscoverUrl("user@domain.com",);
    }
    static bool RedirectionCallback(string url)
    {
        return url.ToLower().StartsWith("https://");
    }

Anyone have an idea?

Micheal P.
  • 55
  • 11

1 Answers1

1

In your given code, you do not call the method RedirectionCallback.

Edit line 8 to the following:

service.AutodiscoverUrl("user@domain.com", RedirectionCallback);
NotTelling
  • 462
  • 3
  • 11
  • You are right. I have add a new method called: ** RedirectionCallback()** and I have Done just the way you have show above. everything works fine now. – Micheal P. Dec 05 '16 at 10:02