private static async Task<CalendarProperties> GetCalendarProperties (CalDavDataAccess calDavDataAccess) { return (await calDavDataAccess.IsCalendarAccessSupported() ? CalendarProperties.CalendarAccessSupported : CalendarProperties.None) | (await calDavDataAccess.IsWriteable() ? CalendarProperties.IsWriteable : CalendarProperties.None) | (await calDavDataAccess.DoesSupportCalendarQuery() ? CalendarProperties.SupportsCalendarQuery : CalendarProperties.None); }
private void TestServerConnection() { const string connectionTestCaption = "Test settings"; try { StringBuilder errorMessageBuilder = new StringBuilder(); if (!ValidateCalendarUrl (errorMessageBuilder)) { MessageBox.Show (errorMessageBuilder.ToString(), "The calendar Url is invalid", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } var dataAccess = new CalDavDataAccess ( new Uri (_calenderUrlTextBox.Text), new CalDavWebClient ( _userNameTextBox.Text, _passwordTextBox.Text, TimeSpan.Parse (ConfigurationManager.AppSettings["calDavConnectTimeout"]), TimeSpan.Parse (ConfigurationManager.AppSettings["calDavReadWriteTimeout"]), Boolean.Parse (ConfigurationManager.AppSettings["disableCertificateValidation"]), Boolean.Parse (ConfigurationManager.AppSettings["enableSsl3"]), Boolean.Parse (ConfigurationManager.AppSettings["enableTls12"])) ); if (!dataAccess.IsCalendarAccessSupported()) MessageBox.Show ("The specified Url does not support calendar access!", connectionTestCaption); if (!dataAccess.IsResourceCalender()) MessageBox.Show ("The specified Url is not a calendar!", connectionTestCaption); if (!dataAccess.IsWriteableCalender()) MessageBox.Show ("The specified Url is a read-only calendar!", connectionTestCaption); if (!dataAccess.DoesSupportCalendarQuery ()) MessageBox.Show ("The specified Url does not support Calendar Queries!", connectionTestCaption); MessageBox.Show ("Connection test successful.", connectionTestCaption); } catch (Exception x) { MessageBox.Show (x.Message, connectionTestCaption); } }
private async Task<bool> TestCalendar (CalDavDataAccess calDavDataAccess, StringBuilder errorMessageBuilder) { bool hasError = false; if (!await calDavDataAccess.IsCalendarAccessSupported()) { errorMessageBuilder.AppendLine ("- The specified Url does not support calendar access."); hasError = true; } if (!await calDavDataAccess.IsWriteable()) { errorMessageBuilder.AppendLine ("- The specified Url is a read-only calendar."); hasError = true; } if (!await calDavDataAccess.DoesSupportCalendarQuery()) { errorMessageBuilder.AppendLine ("- The specified Url does not support Calendar Queries."); hasError = true; } if (_folderType != OlItemType.olAppointmentItem && _folderType != OlItemType.olTaskItem) { errorMessageBuilder.AppendLine ("- The outlook folder is not a calendar or task folder, or there is no folder selected."); hasError = true; } return hasError; }