SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have an issue trying to get all the installed (not activated) features in SharePoint 2010. I have one site and site collection and what I want to do is have one feature that activates all my features at the site and web scopes. I am trying to get a list of the current installed but not activated features.

SPFeatureDefinitionCollection featureDefinitions = SPContext.Current.Site.FeatureDefinitions;

While using the debugger this returns empty and does not contain any features installed, active, or not active. If I use:


It only returns the active features. I was trying to follow this but it does not seem to work for me. The scope of the feature containing the code is "Site"

share|improve this question

You can try something like this in powershell.

$allSiteFeatures = Get-SPFeature | Where-Object { $_.Scope -eq "Site" }
$activeFeatures = Get-SPFeature -Site "http://sitecollectionUrl"

$allSiteFeatures | ForEach-Object {
$active = $false
    foreach($feature in $activeFeatures)
      if($feature.Id.ToString() -eq $_.Id.ToString())
         $active = $true

If you would like to use c# then SPFarm.FeatureDefinitions should give you a collection of feature definitions which you can filter by scope

share|improve this answer
+1 Nice script! – Benny Skogberg Jul 5 '13 at 11:28

Your Answer


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

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