Exemple #1
0
        /// <summary>
        /// Enable in place records management. The in place records management feature will be enabled and
        /// the in place record management will be enabled in all locations with record declaration allowed
        /// by all contributors and undeclaration by site admins
        /// </summary>
        /// <param name="site">Site collection to operate on</param>
        public static void EnableSiteForInPlaceRecordsManagement(this Site site)
        {
            // Activate the "In place records management" feature if not yet enabled
            if (!site.IsFeatureActive(new Guid(INPLACE_RECORDS_MANAGEMENT_FEATURE_ID)))
            {
                //Note: this also sets the ECM_SITE_RECORD_RESTRICTIONS value to "BlockDelete, BlockEdit"
                site.ActivateInPlaceRecordsManagementFeature();
            }

            // Enable in place records management in all locations
            site.SetManualRecordDeclarationInAllLocations(true);

            // Set restrictions to default values after enablement (is also done at feature activation)
            EcmSiteRecordRestrictions restrictions = EcmSiteRecordRestrictions.BlockDelete | EcmSiteRecordRestrictions.BlockEdit;

            site.SetRecordRestrictions(restrictions);

            // Set record declaration to default value
            site.SetRecordDeclarationBy(EcmRecordDeclarationBy.AllListContributors);

            // Set record undeclaration to default value
            site.SetRecordUnDeclarationBy(EcmRecordDeclarationBy.OnlyAdmins);
        }