Feature Exists (Activated on SPSite)


Iterate through SharePoint SPSite collection

- May 29, 2017

Rest of the Story:

Method to iterate through SharePoint SPSite collection to check to see if a feature (featureGuid) exists. If found, method returns true.

   private bool FeatureExists(SPSite siteCollection, Guid featureGuid) {     bool found = false;     foreach (SPFeature feature in siteCollection.Features) {     if (feature.DefinitionId == featureGuid) {
      found = true;       break;    }  }  return found;} 

Cool eh?