ConvertSettings method

  1. @override
GetUserSettingsResponse ConvertSettings(
  1. String smtpAddress,
  2. List<UserSettingName> requestedSettings
)
override
Convert OutlookConfigurationSettings to GetUserSettings response. SMTP address requested. The requested settings.

Implementation

@override
GetUserSettingsResponse ConvertSettings(
    String smtpAddress, List<UserSettingName> requestedSettings) {
  GetUserSettingsResponse response = new GetUserSettingsResponse();
  response.SmtpAddress = smtpAddress;

  if (this.Error != null) {
    response.ErrorCode = AutodiscoverErrorCode.InternalServerError;
    response.ErrorMessage = this.Error!.Message;
  } else {
    switch (this.ResponseType) {
      case AutodiscoverResponseType.Success:
        response.ErrorCode = AutodiscoverErrorCode.NoError;
        response.ErrorMessage = "";
        this._user.ConvertToUserSettings(requestedSettings, response);
        this._account!.ConvertToUserSettings(requestedSettings, response);
        this._ReportUnsupportedSettings(requestedSettings, response);
        break;
      case AutodiscoverResponseType.Error:
        response.ErrorCode = AutodiscoverErrorCode.InternalServerError;
        response.ErrorMessage = "Strings.InvalidAutodiscoverServiceResponse";
        break;
      case AutodiscoverResponseType.RedirectAddress:
        response.ErrorCode = AutodiscoverErrorCode.RedirectAddress;
        response.ErrorMessage = "";
        response.RedirectTarget = this.RedirectTarget;
        break;
      case AutodiscoverResponseType.RedirectUrl:
        response.ErrorCode = AutodiscoverErrorCode.RedirectUrl;
        response.ErrorMessage = "";
        response.RedirectTarget = this.RedirectTarget;
        break;
      default:
        EwsUtilities.Assert(
            false,
            "OutlookConfigurationSettings.ConvertSettings",
            "An unexpected error has occured. This code path should never be reached.");
        break;
    }
  }
  return response;
}