Sunday, May 31, 2009

Displaying Activated features using Application Page

Scenario:
Quickly displaying all the activated feature for a site collection / web

Code:

SPFeatureCollection siteFeatures = SPContext.Current.SiteFeatures;

foreach (SPFeature siteFeature in siteFeatures)
{
Response.Write(siteFeature.Definition.Name);
}

SPFeatureCollection webFeatures = SPContext.Current.SiteFeatures;

foreach (SPFeature webFeature in webFeatures)
{
Response.Write(webFeature.Definition.Name);
}

0 comments: