Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I created a feature receiver whereby on activation will activate and set certain features and its properties. One of that feature is InPlaceRecords. Below is my code in the FeatureActivated method:-

if (!Records.IsInPlaceRecordsEnabled(site))
            {
                //Activate In Place Records Management
                SPFeatureDefinition inPlaceFeature = site.WebApplication.Farm.FeatureDefinitions["InPlaceRecords"];

                if (inPlaceFeature != null)
                {
                    using (SPSite s = new SPSite(site.ID))
                    {
                        s.Features.Add(inPlaceFeature.Id);

                        s.RootWeb.Update();
                    }
                }
            }

            //Record declaration settings
            using (SPSite s = new SPSite(site.ID))
            {
                //set record restriction
                Records.SetRecordDefinitionForSite(s, RecordRestrictions.BlockDelete);

                if (s.RootWeb.Properties.ContainsKey("ecm_SiteRecordDeclarationDefault"))
                {
                    s.RootWeb.Properties["ecm_SiteRecordDeclarationDefault"] = "True";
                }

                if (s.RootWeb.AllProperties.ContainsKey("ecm_siterecordundeclarationby"))
                {
                    s.RootWeb.AllProperties["ecm_siterecordundeclarationby"] = "OnlyAdmins";
                }

                if (s.RootWeb.Properties.ContainsKey("ecm_siterecorddeclarationby"))
                {
                    s.RootWeb.Properties["ecm_siterecorddeclarationby"] = "AllListContributors";
                }

                //Content type publishing hub
                if (s.RootWeb.Properties.ContainsKey("MetadataTimeStamp"))
                {
                    s.RootWeb.Properties["MetadataTimeStamp"] = string.Empty;
                }

                //TODO:activate record search feature

                s.RootWeb.Update();
            }

My problem is during debugging the target properties does not exists (for example ecm_SiteRecordDeclarationDefault). How to perform this task programmatically.

Thanks

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.