Ejemplo n.º 1
0
        /// <summary>
        /// Loads the user setting errors.
        /// </summary>
        /// <param name="reader">The reader.</param>
        private void LoadUserSettingErrorsFromXml(EwsXmlReader reader)
        {
            if (!reader.IsEmptyElement)
            {
                do
                {
                    reader.Read();

                    if ((reader.NodeType == XmlNodeType.Element) && (reader.LocalName == XmlElementNames.UserSettingError))
                    {
                        UserSettingError error = new UserSettingError();
                        error.LoadFromXml(reader);
                        this.UserSettingErrors.Add(error);
                    }
                }while (!reader.IsEndElement(XmlNamespace.Autodiscover, XmlElementNames.UserSettingErrors));
            }
        }
        /// <summary>
        /// Reports any requested user settings that aren't supported by the Outlook provider.
        /// </summary>
        /// <param name="requestedSettings">The requested settings.</param>
        /// <param name="response">The response.</param>
        private void ReportUnsupportedSettings(List <UserSettingName> requestedSettings, GetUserSettingsResponse response)
        {
            // In English: find settings listed in requestedSettings that are not supported by the Legacy provider.
            IEnumerable <UserSettingName> invalidSettingQuery = from setting in requestedSettings
                                                                where !OutlookConfigurationSettings.IsAvailableUserSetting(setting)
                                                                select setting;

            // Add any unsupported settings to the UserSettingsError collection.
            foreach (UserSettingName invalidSetting in invalidSettingQuery)
            {
                UserSettingError settingError = new UserSettingError()
                {
                    ErrorCode    = AutodiscoverErrorCode.InvalidSetting,
                    SettingName  = invalidSetting.ToString(),
                    ErrorMessage = string.Format(Strings.AutodiscoverInvalidSettingForOutlookProvider, invalidSetting.ToString())
                };
                response.UserSettingErrors.Add(settingError);
            }
        }
        /// <summary>
        /// Reports any requested user settings that aren't supported by the Outlook provider.
        /// </summary>
        /// <param name="requestedSettings">The requested settings.</param>
        /// <param name="response">The response.</param>
        private void ReportUnsupportedSettings(List<UserSettingName> requestedSettings, GetUserSettingsResponse response)
        {
            // In English: find settings listed in requestedSettings that are not supported by the Legacy provider.
            IEnumerable<UserSettingName> invalidSettingQuery = from setting in requestedSettings
                                                               where !OutlookConfigurationSettings.IsAvailableUserSetting(setting)
                                                               select setting;

            // Add any unsupported settings to the UserSettingsError collection.
            foreach (UserSettingName invalidSetting in invalidSettingQuery)
            {
                UserSettingError settingError = new UserSettingError()
                {
                    ErrorCode = AutodiscoverErrorCode.InvalidSetting,
                    SettingName = invalidSetting.ToString(),
                    ErrorMessage = string.Format(Strings.AutodiscoverInvalidSettingForOutlookProvider, invalidSetting.ToString())
                };
                response.UserSettingErrors.Add(settingError);
            }
        }