Autodiscover best practices
Published: July 16, 2012
Applies to: Exchange 2013 | Exchange Online | Exchange Server 2010 | Exchange Web Services (EWS) Managed API
The Autodiscover service enables you to retrieve configuration information for any user in your domain. This topic provides some best practices for working with the Autodiscover service.
If the URL of the Exchange Web Services (EWS) endpoint is already known, you do not need to use the Autodiscover service to make the connection. However, you can set the URL manually or use the best endpoint for a given user. Because the location of the best endpoint for a given user can change, for example when a new Client Access server is deployed, or can vary depending on the user, we recommend that you use the Autodiscover service.
The following example shows how to manually set the URL of the EWS endpoint.
The following example shows how to use the Autodiscover service to determine the best endpoint that is closest to the user's mailbox server.
If you try to perform an autodiscovery on a nonexistent e-mail address, your attempt will result in an error. To prevent an invalid address from causing an application failure, we recommend that you include the AutodiscoverUrl call in a Try/Catch block. The following example shows how to use a Try/Catch block to handle the exception and to display the error message. When the e-mail address does not exist in the domain, an exception is thrown and the following message is displayed:
The e-mail address cannot be found.
The Autodiscover service enables client applications to retrieve many configuration settings. However, this consumes bandwidth and possibly exposes the configuration settings. We recommend that you use the GetUserSettings(String, []) method to retrieve only the specific configuration settings that are required. In the following example, only four settings are requested: UserDisplayName, InternalMailboxServer, PublicFolderServer, and ExternalMailboxServer.
Date | Description |
|---|---|
July 16, 2012 | Initial publication |