private void GetAccountSettings()
{
_getAccountSettingsCommand.SetCanExecute (false);
try
{
var serverAccountSettings = _outlookAccountPasswordProvider.GetAccountServerSettings (_currentOptions.FolderAccountName);
EmailAddress = serverAccountSettings.EmailAddress;
string path = !string.IsNullOrEmpty (CalenderUrl) ? new Uri (CalenderUrl).AbsolutePath : string.Empty;
bool success;
var dnsDiscoveredUrl = OptionTasks.DoSrvLookup (EmailAddress, OlItemType.olAppointmentItem, out success);
CalenderUrl = success ? dnsDiscoveredUrl : "https://" + serverAccountSettings.ServerString + path;
UserName = serverAccountSettings.UserName;
UseAccountPassword = true;
}
catch (Exception x)
{
s_logger.Error ("Exception while getting account settings.", x);
string message = null;
for (Exception ex = x; ex != null; ex = ex.InnerException)
message += ex.Message + Environment.NewLine;
MessageBox.Show (message, "Account settings");
}
finally
{
_getAccountSettingsCommand.SetCanExecute (true);
}
}