public bool Validate(StringBuilder errorMessageBuilder)
        {
            bool result = true;

            if (_selectedFolderOrNull == null)
            {
                errorMessageBuilder.AppendLine(Strings.Get($"- There is no Outlook folder selected."));
                result = false;
            }

            if (_useWebDavCollectionSync && _selectedFolderOrNull?.DefaultItemType != OlItemType.olAppointmentItem && _selectedFolderOrNull?.DefaultItemType != OlItemType.olContactItem)
            {
                errorMessageBuilder.AppendLine(Strings.Get($"- WebDav collection sync is currently just supported for appointments and contacts."));
                result = false;
            }

            if (_isGoogle)
            {
                var serverAdapterType = ServerAdapterType;
                if (serverAdapterType != ServerAdapterType.GoogleTaskApi && serverAdapterType != ServerAdapterType.GoogleContactApi)
                {
                    result &= OptionTasks.ValidateWebDavUrl(CalenderUrl, errorMessageBuilder, true);
                }

                result &= OptionTasks.ValidateEmailAddress(errorMessageBuilder, EmailAddress, false);
            }
            else
            {
                result &= OptionTasks.ValidateWebDavUrl(CalenderUrl, errorMessageBuilder, true);
                result &= OptionTasks.ValidateEmailAddress(errorMessageBuilder, EmailAddress, true);
            }
            if (!string.IsNullOrEmpty(_profileTypeOrNull) && String.Equals(_profileTypeOrNull, "Swisscom", StringComparison.OrdinalIgnoreCase) && _selectedFolderOrNull?.DefaultItemType != OlItemType.olContactItem)
            {
                result = false;
                errorMessageBuilder.AppendLine(Strings.Get($"- The Swisscom profile is currently just supported for contacts, please choose a Contacts folder"));
            }

            if (IsChunkedSynchronizationEnabled && ChunkSize < 1)
            {
                result = false;
                errorMessageBuilder.AppendLine(Strings.Get($"- The chunk size has to be 1 or greater."));
            }

            if (MappingConfigurationModelOrNull != null)
            {
                result &= MappingConfigurationModelOrNull.Validate(errorMessageBuilder);
            }

            return(result);
        }
        public bool Validate(StringBuilder errorMessageBuilder)
        {
            bool result = true;

            if (_selectedFolderOrNull == null)
            {
                errorMessageBuilder.AppendLine(Strings.Get($"- There is no Outlook folder selected."));
                result = false;
            }

            if (_useWebDavCollectionSync && _selectedFolderOrNull?.DefaultItemType != OlItemType.olAppointmentItem && _selectedFolderOrNull?.DefaultItemType != OlItemType.olContactItem)
            {
                errorMessageBuilder.AppendLine(Strings.Get($"- WebDav collection sync ist currently just supported for appointments and contacts."));
                result = false;
            }

            if (_isGoogle)
            {
                var serverAdapterType = ServerAdapterType;
                if (serverAdapterType != ServerAdapterType.GoogleTaskApi && serverAdapterType != ServerAdapterType.GoogleContactApi)
                {
                    result &= OptionTasks.ValidateWebDavUrl(CalenderUrl, errorMessageBuilder, true);
                }

                result &= OptionTasks.ValidateGoogleEmailAddress(errorMessageBuilder, EmailAddress);
            }
            else
            {
                result &= OptionTasks.ValidateWebDavUrl(CalenderUrl, errorMessageBuilder, true);
                result &= OptionTasks.ValidateEmailAddress(errorMessageBuilder, EmailAddress);
            }

            if (IsChunkedSynchronizationEnabled && ChunkSize < 1)
            {
                result = false;
                errorMessageBuilder.AppendLine(Strings.Get($"- The chunk size hast to be 1 or greater."));
            }

            if (MappingConfigurationModelOrNull != null)
            {
                result &= MappingConfigurationModelOrNull.Validate(errorMessageBuilder);
            }

            return(result);
        }
Beispiel #3
0
        public bool Validate(StringBuilder errorMessageBuilder)
        {
            bool result = true;

            if (_selectedFolderOrNull == null)
            {
                errorMessageBuilder.AppendLine("- There is no Outlook Folder selected.");
                result = false;
            }

            if (_isGoogle)
            {
                var serverAdapterType = ServerAdapterType;
                if (serverAdapterType != ServerAdapterType.GoogleTaskApi && serverAdapterType != ServerAdapterType.GoogleContactApi)
                {
                    result &= OptionTasks.ValidateWebDavUrl(CalenderUrl, errorMessageBuilder, true);
                }

                result &= OptionTasks.ValidateGoogleEmailAddress(errorMessageBuilder, EmailAddress);
            }
            else
            {
                result &= OptionTasks.ValidateWebDavUrl(CalenderUrl, errorMessageBuilder, true);
                result &= OptionTasks.ValidateEmailAddress(errorMessageBuilder, EmailAddress);
            }

            if (IsChunkedSynchronizationEnabled && ChunkSize < 1)
            {
                result = false;
                errorMessageBuilder.AppendLine("- The chunk size hast to be 1 or greater.");
            }

            if (MappingConfigurationModelOrNull != null)
            {
                result &= MappingConfigurationModelOrNull.Validate(errorMessageBuilder);
            }

            return(result);
        }