GetUserSettingsWithSmtpAddress method

Future<GetUserSettingsResponse> GetUserSettingsWithSmtpAddress(
  1. String userSmtpAddress,
  2. List<UserSettingName> userSettingNames
)
Initializes a new instance of the The service. Retrieves the specified settings for single SMTP address. The SMTP addresses of the user. The user setting names.

Implementation

//        AutodiscoverService.withExchangeService(ExchangeServiceBase service)
//            : this(service, service.RequestedServerVersion)
//        {
//        }

/// <summary>
/// Retrieves the specified settings for single SMTP address.
/// </summary>
/// <param name="userSmtpAddress">The SMTP addresses of the user.</param>
/// <param name="userSettingNames">The user setting names.</param>
/// <returns>A UserResponse object containing the requested settings for the specified user.</returns>
/// <remarks>
/// This method handles will run the entire Autodiscover "discovery" algorithm and will follow address and URL redirections.
/// </remarks>
Future<GetUserSettingsResponse> GetUserSettingsWithSmtpAddress(
    String userSmtpAddress, List<UserSettingName> userSettingNames) async {
  List<UserSettingName> requestedSettings = List.from(userSettingNames);

  if (StringUtils.IsNullOrEmpty(userSmtpAddress)) {
    throw new ServiceValidationException(
        "Strings.InvalidAutodiscoverSmtpAddress");
  }

  if (requestedSettings.length == 0) {
    throw new ServiceValidationException(
        "Strings.InvalidAutodiscoverSettingsCount");
  }

  if (this.RequestedServerVersion.index <
      _MinimumRequestVersionForAutoDiscoverSoapService.index) {
    // TODO implement autodiscovery for Exchange 2007
    throw UnsupportedError("Doesn't support autodiscovery for Exchange2007");
//                return await this.InternalGetLegacyUserSettings(userSmtpAddress, requestedSettings);
  } else {
    return await this
        .InternalGetSoapUserSettings(userSmtpAddress, requestedSettings);
  }
}