Monthly Archives: March 2010

Adding element to web.config on feature activation

public override void FeatureActivated(SPFeatureReceiverProperties properties) { SPSite site = (SPSite)properties.Feature.Parent; SPWebConfigModification controlsSection = new SPWebConfigModification(“controls”, “configuration/system.web/pages”); controlsSection.Owner = “My.Menu”; controlsSection.Sequence = 20; controlsSection.Type = SPWebConfigModification.SPWebConfigModificationType.EnsureSection; controlsSection.Value = “”; SPWebConfigModification addElement = new SPWebConfigModification( @”add[@tagPrefix=””SharePoint””][@namespace=””My.Menu””][@assembly=””My.Menu, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cd3368f0ff736bff””]”, “configuration/system.web/pages/controls”); addElement.Owner =

Posted in Uncategorized

Removing element from web.config on feature de-activation

public override void FeatureDeactivating(SPFeatureReceiverProperties properties) { SPSite site = (SPSite)properties.Feature.Parent; SPWebConfigModification controlsSection = new SPWebConfigModification(“controls”, “configuration/system.web/pages”); controlsSection.Owner = “My.Menu”; controlsSection.Sequence = 20; controlsSection.Type = SPWebConfigModification.SPWebConfigModificationType.EnsureSection; controlsSection.Value = “”; SPWebConfigModification addElement = new SPWebConfigModification( @”add[@tagPrefix=””SharePoint””][@namespace=””My.Menu””][@assembly=””My.Menu, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cd3368f0ff736bff””]”, “configuration/system.web/pages/controls”); addElement.Owner =

Posted in SharePoint