public IHttpActionResult PostConfiguration(UserConfigurationType configurationType, string configurationValue)
        {
            //get current user
            var user = ApplicationContext.Current.CurrentUser;

            user.SetPropertyValue(configurationType.ToString(), configurationValue);
            return(RespondSuccess());
        }
Exemple #2
0
        internal override CalendarProcessingFlags?GetCalendarConfig()
        {
            CalendarProcessingFlags  value = (CalendarProcessingFlags)CalendarConfigurationSchema.AutomateProcessing.DefaultValue;
            GetUserConfigurationType getUserConfigurationType = new GetUserConfigurationType();

            getUserConfigurationType.UserConfigurationProperties = UserConfigurationPropertyType.Dictionary;
            getUserConfigurationType.UserConfigurationName       = new UserConfigurationNameType
            {
                Name = "Calendar",
                Item = new DistinguishedFolderIdType
                {
                    Id = DistinguishedFolderIdNameType.calendar
                }
            };
            try
            {
                GetUserConfigurationResponseType userConfiguration = this.binding.GetUserConfiguration(getUserConfigurationType);
                bool flag;
                UserConfigurationType userConfigurationType = this.HandleGetUserConfigurationResponse(userConfiguration, out flag);
                if (flag)
                {
                    return(new CalendarProcessingFlags?(value));
                }
                if (userConfigurationType == null || userConfigurationType.Dictionary == null)
                {
                    Globals.ConsistencyChecksTracer.TraceDebug((long)this.GetHashCode(), "GetUserConfiguration returned NULL userConfigurationType.");
                    return(null);
                }
                foreach (UserConfigurationDictionaryEntryType userConfigurationDictionaryEntryType in userConfigurationType.Dictionary)
                {
                    if (userConfigurationDictionaryEntryType.DictionaryKey != null && userConfigurationDictionaryEntryType.DictionaryKey.Value != null && userConfigurationDictionaryEntryType.DictionaryKey.Value.Length > 0 && string.Compare(userConfigurationDictionaryEntryType.DictionaryKey.Value[0], CalendarConfigurationSchema.AutomateProcessing.Name, StringComparison.OrdinalIgnoreCase) == 0 && userConfigurationDictionaryEntryType.DictionaryValue != null && userConfigurationDictionaryEntryType.DictionaryValue.Value != null && userConfigurationDictionaryEntryType.DictionaryValue.Value.Length > 0)
                    {
                        CalendarProcessingFlags value2 = (CalendarProcessingFlags)Enum.Parse(typeof(CalendarProcessingFlags), userConfigurationDictionaryEntryType.DictionaryValue.Value[0]);
                        return(new CalendarProcessingFlags?(value2));
                    }
                }
            }
            catch (ProtocolViolationException exception)
            {
                this.HandleRemoteException(exception);
            }
            catch (SecurityException exception2)
            {
                this.HandleRemoteException(exception2);
            }
            catch (ArgumentException exception3)
            {
                this.HandleRemoteException(exception3);
            }
            catch (InvalidOperationException exception4)
            {
                this.HandleRemoteException(exception4);
            }
            catch (NotSupportedException exception5)
            {
                this.HandleRemoteException(exception5);
            }
            catch (XmlException exception6)
            {
                this.HandleRemoteException(exception6);
            }
            catch (XPathException exception7)
            {
                this.HandleRemoteException(exception7);
            }
            catch (SoapException exception8)
            {
                this.HandleRemoteException(exception8);
            }
            catch (IOException exception9)
            {
                this.HandleRemoteException(exception9);
            }
            return(new CalendarProcessingFlags?(value));
        }