This sample shows you how to implement an Autodiscover client by using the SOAP Autodiscover and POX Autodiscover services.

Description of the Exchange 2013: Get user settings with Autodiscover sample

This sample authenticates an email address and password entered from the console, performs a service connection point (SCP) lookup to locate Autodiscover endpoints, then sends Autodiscover requests to retrieve user settings.

Prerequisites

This sample requires the following:

  • A target server that is running a version of Exchange starting with Exchange Server 2007 Service Pack 1 (SP1), including Exchange Online.
  • The .NET Framework 4.5.
  • Visual Studio 2012 with the Visual Web Developer and C# components and an open Visual Studio 2012 solution.

Or

  • A text editor to create and edit source code files and a command prompt window to run a .NET Framework command line compiler.

Key components of the sample

This sample contains the following files:

  • AutodiscoverSample.sln — The Visual Studio 2012 solution file for the AutodiscoverSample project.
  • AutodiscoverSample.csproj — The Visual Studio 2012 project file for the Autodiscover sample.
  • App.config — Contains configuration data for the AutodiscoverSample project.
  • AssemblyInfo.cs — Contains basic information about the sample application.
  • AutodiscoverRequest.cs — Contains the using statements, namespace, class, and functions to implement an Autodiscover request.
  • AutodiscoverUrlList.cs — Contains the using statements, namespace, class, and functions to implement an ordered list of Autodiscover endpoint URLs.
  • CommandLineArgs.cs — Contains the using statements, namespace, class, and functions to parse the command line arguments.
  • POXXmlStrings.cs — Contains constant strings representing XML namespaces and element names used in POX requests and responses.
  • Program.cs — Contains the using statements, namespace, class, and code to implement the sample program.
  • SOAPXmlStrings.cs — Contains constant strings representing XML namespaces and element names used in SOAP requests and responses.
  • Tracing.cs — Contains the using statements, namespace, class, and functions to output to a file and the console.

Configure the sample

Follow these steps to configure the Exchange 2013: Get user settings with Autodiscover sample. Specify command line parameters to be used when running the sample in the Visual Studio 2012 environment.

 

  1. In Visual Studio, choose AutodiscoverSample Properties… from the Project menu.
  2. Select Debug.
  3. Enter parameters in the Command line arguments text box.

 

Note

For a list of parameters, see "Run and test the sample".

Build the sample

Press or select F6 to build and deploy the sample.

Run and test the sample

The sample uses the command line arguments listed in the following table.

Argument

Description

emailAddress

Required. The email address to send to the Autodiscover server.

-skipSOAP

Optional. If present, the application will not send SOAP Autodiscover requests. Instead, it will only send POX Autodiscover requests.

-auth authEmailAddress

Optional. If present, the authEmailAddress argument will be used to authenticate the connection instead of the emailAddress argument.

Press or select F5 to run the sample.

Related content

Change log

Date

Description

May 19, 2014

Corrected bug in TryAutodiscoverUrl function that failed to return null when the specified URL has already been tried.

October 4, 2013

First release.