1

we have a custom feature that is associated with custom site template. There are many sites created making use of this site template. when the new site is created this custom feature is also available. when we activate this feature there are fews issues coming up.

we want to hide this feature from users so that they cannot active it.

Can any one help me how to hide or remove this feature from already existing site.

1

Use PowerShell command:

Specify the XML file

$thisXMLfile = $myServerPath + $myXMLpath + "feature.xml"

Load the XML file

$featureXMLfile = [xml] (get-content $thisXMLfile)

Set the Attribute

$featureXMLfile.Feature.SetAttribute("Hidden", "TRUE")

Read full Article

N.B. I haven't tried this code myself but logic seems to be ok.

0

You can have a custom solution which would iterate through the site collections and then will make the required features invisible.

using (SPSite site = new SPSite(SPContext.Current.Site.Url))
        {
            SPWebApplication webapp = site.WebApplication;

            FeatureDev(webapp);
        }


public void FeatureDev(SPWebApplication webApp)
    {
        //Iterate through each site collection inside the web application

       foreach (SPSite site in webApp.Sites)
        {
            using (SPWeb oSPWeb = site.OpenWeb())
            {
                //get the features and deactivate
            }
        }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.