/// <summary> /// Defines the manual in place record declaration for this list /// </summary> /// <param name="list">List to operate against</param> /// <param name="settings"><see cref="EcmListManualRecordDeclaration"/> enum that defines the manual in place record declaration settings for this list</param> public static void SetListManualRecordDeclaration(this List list, EcmListManualRecordDeclaration settings) { if (settings == EcmListManualRecordDeclaration.UseSiteCollectionDefaults) { //If we set list record declaration back to the default values then we also need to //turn off auto record declaration. Other property bag values are left as is: when //settings are changed again these properties are also again usable if (list.PropertyBagContainsKey(ECM_AUTO_DECLARE_RECORDS)) { list.SetListAutoRecordDeclaration(false); } //Set the property that dictates custom list record settings to false list.SetPropertyBagValue(ECM_IPR_LIST_USE_LIST_SPECIFIC, false.ToString()); } else if (settings == EcmListManualRecordDeclaration.AlwaysAllowManualDeclaration) { list.SetPropertyBagValue(ECM_ALLOW_MANUAL_DECLARATION, true.ToString()); //Set the property that dictates custom list record settings to true list.SetPropertyBagValue(ECM_IPR_LIST_USE_LIST_SPECIFIC, true.ToString()); } else if (settings == EcmListManualRecordDeclaration.NeverAllowManualDeclaration) { list.SetPropertyBagValue(ECM_ALLOW_MANUAL_DECLARATION, false.ToString()); //Set the property that dictates custom list record settings to true list.SetPropertyBagValue(ECM_IPR_LIST_USE_LIST_SPECIFIC, true.ToString()); } else { throw new ArgumentOutOfRangeException(nameof(settings)); } }
protected void btnSaveListScopedIPRSettings_Click(object sender, EventArgs e) { List ipr = cc.Web.GetListByTitle(IPR_LIBRARY); EcmListManualRecordDeclaration listManual = (EcmListManualRecordDeclaration)Convert.ToInt32(rdListAvailability.SelectedValue); ipr.SetListManualRecordDeclaration(listManual); ipr.SetListAutoRecordDeclaration(chbAutoDeclare.Checked); //Refresh the settings as AutoDeclare changes the manual settings if (ipr.IsListRecordSettingDefined()) { rdListAvailability.SelectedValue = Convert.ToString((int)ipr.GetListManualRecordDeclaration()); chbAutoDeclare.Checked = ipr.GetListAutoRecordDeclaration(); rdListAvailability.Enabled = !chbAutoDeclare.Checked; } }
/// <summary> /// Defines the manual in place record declaration for this list /// </summary> /// <param name="list">List to operate against</param> /// <param name="settings"><see cref="EcmListManualRecordDeclaration"/> enum that defines the manual in place record declaration settings for this list</param> public static void SetListManualRecordDeclaration(this List list, EcmListManualRecordDeclaration settings) { if (settings == EcmListManualRecordDeclaration.UseSiteCollectionDefaults) { //If we set list record declaration back to the default values then we also need to //turn off auto record declaration. Other property bag values are left as is: when //settings are changed again these properties are also again usable if (list.PropertyBagContainsKey(ECM_AUTO_DECLARE_RECORDS)) { list.SetListAutoRecordDeclaration(false); } //Set the property that dictates custom list record settings to false list.SetPropertyBagValue(ECM_IPR_LIST_USE_LIST_SPECIFIC, false.ToString()); } else if (settings == EcmListManualRecordDeclaration.AlwaysAllowManualDeclaration) { list.SetPropertyBagValue(ECM_ALLOW_MANUAL_DECLARATION, true.ToString()); //Set the property that dictates custom list record settings to true list.SetPropertyBagValue(ECM_IPR_LIST_USE_LIST_SPECIFIC, true.ToString()); } else if (settings == EcmListManualRecordDeclaration.NeverAllowManualDeclaration) { list.SetPropertyBagValue(ECM_ALLOW_MANUAL_DECLARATION, false.ToString()); //Set the property that dictates custom list record settings to true list.SetPropertyBagValue(ECM_IPR_LIST_USE_LIST_SPECIFIC, true.ToString()); } else { throw new ArgumentOutOfRangeException("settings"); } }