AutodiscoverUrlWithCallback method
Future<void>
AutodiscoverUrlWithCallback(
- String emailAddress,
- AutodiscoverRedirectionUrlValidationCallback validateRedirectionUrlCallback
Implementation
Future<void> AutodiscoverUrlWithCallback(
String emailAddress,
AutodiscoverRedirectionUrlValidationCallback validateRedirectionUrlCallback,
) async {
Uri exchangeServiceUrl;
if (RequestedServerVersion.index > ExchangeVersion.Exchange2007_SP1.index) {
try {
exchangeServiceUrl =
await GetAutodiscoverUrlWithExchangeVersionAndCallback(
emailAddress,
RequestedServerVersion,
validateRedirectionUrlCallback,
);
Url = AdjustServiceUriFromCredentials(exchangeServiceUrl);
return;
} on AutodiscoverLocalException catch (ex) {
TraceMessage(
enumerations.TraceFlags.AutodiscoverResponse,
"Autodiscover service call failed with error '${ex.message}'. Will try legacy service",
);
} on ServiceRemoteException catch (ex) {
// Special case: if the caller's account is locked we want to return this exception, not continue.
if (ex is AccountIsLockedException) {
rethrow;
}
TraceMessage(
enumerations.TraceFlags.AutodiscoverResponse,
"Autodiscover service call failed with error '${ex.message}'. Will try legacy service",
);
}
}
// Try legacy Autodiscover provider
exchangeServiceUrl = await GetAutodiscoverUrlWithExchangeVersionAndCallback(
emailAddress,
ExchangeVersion.Exchange2007_SP1,
validateRedirectionUrlCallback,
);
Url = AdjustServiceUriFromCredentials(exchangeServiceUrl);
}