Feature Exists (Activated on SPSite)

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?

Author

David

comments powered by Disqus