Introduction

This sample uses the Exchange Managed API 2.0 and custom code to do several forms of autodiscover against Exchange. It handles callbacks for doing redirection and certificates.  Logging is provided for referrels, redirection, certificates and network activity. This code will work for both on-premise and hosted Exchange servers such as Exchange Online/Office 365.    There is example contained written in raw C# code that shows how you might do the POX, SCP look-up and SOAP Autodiscover processes.

Building the Sample

You will need to use Visual Studio 2010 to build the project.

Description

This unsupported sample provides help by demonstrating how to properly call the
Exchange AutoDiscovery web service. Executing the built application can be used
for gathering information on what is accessed during the AutoDiscover process
and also be used for troubleshooting. If you use the code or executable, you
are responsible for its usage and will need to take ownership of the code - you
should also only use this in a test lab and not production.

This is sample code and there are no implied warranties or guarantees as to its
behavior. If you use this app or its code, you need to take 100% responsibility
for its code and its usage. It’s considered to be unsupported sample code which
demonstrates the concept of doing AutoDiscovery with the Exchange Managed API and
should only be used in a lab environment.

 

For external AutoDiscovery and connectivity checker, be sure to look at the Remote Connectivity Analyzer.

Remote Connectivity Analyzer

    https://www.testexchangeconnectivity.com/

 

 

You can include code snippets, images, videos.   

 

C#
Edit|Remove
            System.Net.Security.RemoteCertificateValidationCallback oCallback = null; 
            if (service.RedirectionUrlValidationCallback != null)  // If a prior one was set, save it 
                oCallback = ServicePointManager.ServerCertificateValidationCallback;  // Save  
 
            ServicePointManager.ServerCertificateValidationCallback = oAutodiscoveryCallbackHelper.CertificateValidationCallBack; 
 
            service.RedirectionUrlValidationCallback = oAutodiscoveryCallbackHelper.RedirectionUrlValidationCallbackAllowAnything; 
 
... 
 
 
                    try 
                    { 
                        oResponse = service.GetUserSettings( 
                            sUserSmtpAddress, 
                            UserSettingName.ActiveDirectoryServer, 
                            UserSettingName.AlternateMailboxes, 
                            UserSettingName.CasVersion, 
                            UserSettingName.ExternalEwsUrl, 
                            UserSettingName.InternalEwsUrl 
                        ); 
                    }