Autodiscover For Exchange - Microsoft Docs

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 8

9/11/22, 11:47 PM Autodiscover for Exchange | Microsoft Docs

Autodiscover for Exchange


Article • 01/15/2020 • 5 minutes to read

Learn about the Autodiscover service in Exchange.

The Exchange Autodiscover service provides an easy way for your client application to
configure itself with minimal user input. Most users know their email address and
password, and with those two pieces of information, you can retrieve all the other details
you need to get up and running. For Exchange Web Services (EWS) clients, Autodiscover is
typically used to find the EWS endpoint URL, but Autodiscover can also provide
information to configure clients that use other protocols. Autodiscover works for client
applications that are inside or outside firewalls and will work in resource forest and
multiple forest scenarios.

Overview of the Autodiscover process


The Autodiscover process essentially has three phases. In phase one, you generate a list of
potential Autodiscover servers, and in phase two, you try each server in your list until you
(hopefully) get a successful response. If none of your candidates worked out, you move on
to phase three, which represents a "last ditch" attempt to find an Autodiscover endpoint.

The ExchangeService.AutodiscoverUrl method in the EWS Managed API implements all


three phases of this process for you, so if you are using the EWS Managed API, you don't
need to worry about implementing Autodiscover yourself. The following figure shows the
three phases of the Autodiscover process.

Figure 1. Three phases of the Autodiscover process

https://docs.microsoft.com/en-us/exchange/client-developer/exchange-web-services/autodiscover-for-exchange 1/8
9/11/22, 11:47 PM Autodiscover for Exchange | Microsoft Docs

Phase 1: Defining the candidate pool


Before you can use Autodiscover, you have to locate the right Autodiscover server for your
user. Luckily, Autodiscover defines a limited number of places for you to look. In the case
where multiple candidates are found, Autodiscover also defines a way to generate and
prioritize the list.
Table 1: Autodiscover endpoint candidate sources

Place to What you'll find


look

https://docs.microsoft.com/en-us/exchange/client-developer/exchange-web-services/autodiscover-for-exchange 2/8
9/11/22, 11:47 PM Autodiscover for Exchange | Microsoft Docs

Place to What you'll find


look

Active For domain-joined clients, this is the first place to look. Exchange publishes service
Directory connection point (SCP) objects in AD DS, which allows Autodiscover requests to be
Domain routed to servers based on Active Directory sites. The results of an SCP lookup should
Services be at the top of your candidate list.
(AD DS)
NOTE: SCP lookup isn't available for clients that are not joined to a domain or that do
not have access to Active Directory servers. In this case, you should skip SCP lookup.

The user's Autodiscover defines two standard endpoint URL forms that are derived from the
email domain portion of the user's email address:
address "https://" + domain + "/autodiscover/autodiscover" + *fileExtension*
domain "https://autodiscover." + domain + "/autodiscover/autodiscover" +
*fileExtension*

The value of fileExtension depends on which Autodiscover access method you are
using, SOAP or POX . The SOAP service uses a ".svc" file extension; POX uses ".xml".

The following figure shows how to generate an Autodiscover endpoint list.


Figure 2. Process for generating an Autodiscover endpoint list

https://docs.microsoft.com/en-us/exchange/client-developer/exchange-web-services/autodiscover-for-exchange 3/8
9/11/22, 11:47 PM Autodiscover for Exchange | Microsoft Docs

Phase 2: Trying each candidate


After you generate an ordered list of potential candidates, the next step is try each one in
the list by sending a request to the URL and validating the results, as shown in Figure 3.
When you get a successful response, you're done!

Figure 3. Trying each endpoint candidate in order

Before you send a request to a candidate, make sure it is trustworthy. Remember that
you're sending the user's credentials, so it's important to make sure that you're only
sharing them with a server you can trust. At a minimum, you should verify:

That the endpoint is an HTTPS endpoint. Client applications should not authenticate
or send data to a non-SSL endpoint.
That the SSL certificate presented by the server is valid and from a trusted authority.

7 Note

These are just basic security suggestions. Whenever you are working with
authentication, make sure that your code meets the security requirements of your
organization.

https://docs.microsoft.com/en-us/exchange/client-developer/exchange-web-services/autodiscover-for-exchange 4/8
9/11/22, 11:47 PM Autodiscover for Exchange | Microsoft Docs

The type of request you send depends on how you are accessing the Autodiscover service.

Table 2. Types of Autodiscover requests

If you are using… Send a request by using…

The EWS Managed API The GetUserSettings method.

The SOAP Autodiscover service The GetUserSettings operation.

The POX Autodiscover service An HTTP POST with an Autodiscover request body .

Phase 3: Trying other alternatives


In some cases you might try all the endpoints in your list, only to find that all of them
return an error. Before throwing in the towel, you can try a couple more things: you can
send an unauthenticated GET request, or query DNS for an SRV record. If these attempts
also don't yield results, you cannot contact the Autodiscover service.

Figure 4. Trying other alternatives

Sending an unauthenticated GET request


The first thing to try is to send an unauthenticated GET request to an endpoint derived
from the user's email address. The format of that endpoint is "http://autodiscover." +
domain + "/autodiscover/autodiscover.xml". Note that this is NOT an SSL endpoint. If the
server returns a 302 redirect response, you can then attempt to resend the Autodiscover
request to the endpoint URL in the Location header of the response.

Querying DNS for an SRV record


If the unauthenticated GET request doesn't work out, the last thing to try is a DNS query
for SRV records for the Autodiscover service. The record will take the form
https://docs.microsoft.com/en-us/exchange/client-developer/exchange-web-services/autodiscover-for-exchange 5/8
9/11/22, 11:47 PM Autodiscover for Exchange | Microsoft Docs

"_autodiscover._tcp." + domain. This query might return multiple records, but you should
only use records that point to an SSL endpoint and that have the highest priority and
weight.

Options for using Autodiscover


You can access Autodiscover either by using the SOAP or the POX web service. The method
you use depends on your requirements and environment; however, we recommend using
the SOAP web service, if possible. The EWS Managed API is also an option. It implements
the client portion of both the SOAP and POX Autodiscover services.

Table 3: Options for accessing Autodiscover

Option Pros Cons

EWS Managed Implements Limited to the user settings that are available in the
API the Microsoft.Exchange.WebServices.Autodiscover.UserSettingName
Autodiscover enumeration.
process for
you. Only available for .NET Framework applications.

Uses both the


SOAP and
POX
Autodiscover
services.

Works with
Exchange
Online,
Exchange
Online as
part of Office
365, or a
version of
Exchange
starting with
Exchange
2007 SP1.

Easy to use.

https://docs.microsoft.com/en-us/exchange/client-developer/exchange-web-services/autodiscover-for-exchange 6/8
9/11/22, 11:47 PM Autodiscover for Exchange | Microsoft Docs

Option Pros Cons

SOAP Platform Not available in Exchange 2007.


Autodiscover independent.

Allows you to
request just
the settings
you are
interested in.

POX Platform Does not allow you to request specific settings.


Autodiscover independent.

Supported in
Exchange
Online and all
versions of
Exchange
starting with
Exchange
2007 SP1.

In this section
Find Autodiscover endpoints by using SCP lookup in Exchange

Generate a list of Autodiscover endpoints

Use Autodiscover to find connection points


Get user settings from Exchange by using Autodiscover

Get domain settings from an Exchange server


Refresh configuration information by using Autodiscover

Handling Autodiscover error messages

Improving performance when using Autodiscover for Exchange

See also
https://docs.microsoft.com/en-us/exchange/client-developer/exchange-web-services/autodiscover-for-exchange 7/8
9/11/22, 11:47 PM Autodiscover for Exchange | Microsoft Docs

Start using web services in Exchange


Exchange 2013: Get user settings with Autodiscover
Autodiscover Checker sample
Develop web service clients for Exchange

https://docs.microsoft.com/en-us/exchange/client-developer/exchange-web-services/autodiscover-for-exchange 8/8

You might also like