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); } }
public void AutoFillServerSettings(OptionsModel optionsModel) { var serverAccountSettings = _outlookAccountPasswordProvider.GetAccountServerSettings(optionsModel.FolderAccountName); optionsModel.EmailAddress = serverAccountSettings.EmailAddress; string path = !string.IsNullOrEmpty(optionsModel.CalenderUrl) ? new Uri(optionsModel.CalenderUrl).AbsolutePath : string.Empty; bool success; var dnsDiscoveredUrl = OptionTasks.DoSrvLookup(optionsModel.EmailAddress, OlItemType.olAppointmentItem, out success); optionsModel.CalenderUrl = success ? dnsDiscoveredUrl : "https://" + serverAccountSettings.ServerString + path; optionsModel.UserName = serverAccountSettings.UserName; optionsModel.UseAccountPassword = true; }
public void DiscoverAccountServerSettings() { var serverAccountSettings = _outlookAccountPasswordProvider.GetAccountServerSettings(null); EmailAddress = serverAccountSettings.EmailAddress; }