Is it possible to turn on a custom feature atomically when you create a new site collection? I have a branding feature that I want to be turned on by default for each site collection made.
For now, SharePoint 2010 does not support event for site collection adding or added.So it is not possible to do it programmatically
Yes, You can plugin your feature to the site definition used for the site collection by "Feature Stapling".
You can define a feature at scope of Web application. It will automatically activate the stapled feature(which is your feature) within every site (in web application) that is based on the site definition you provide in <FeatureSiteTemplateAssociation> like below sample.
If you want to activate the feature for all kind of sites in web application, you can associate stapling a feature to global site definition(TemplateName=" GLOBAL") and blank site (TemplateName=" STS#1").
<Elements xmlns="http://schemas.microsoft.com/sharepoint/"> <FeatureSiteTemplateAssociation Id="edcdcd75-dff2-479d-ac32-b37f8fa9d459" TemplateName=" GLOBAL" /> <FeatureSiteTemplateAssociation Id="edcdcd75-dff2-479d-ac32-b37f8fa9d459" TemplateName=" STS#1" /> </Elements>
Change the Id to your feature Id in above sample.
The scope of the feature that does the stapling must be higher than the features being stapled. For example, a feature at the site collection scope can staple only features at site-level scope. So, you can fine tune the your feature scope accordingly
Yes, it's possible. The (probably) easiest way is to use feature stapling. Then you can say that all new instances of e.g. STS#0 (Team site), should activate this feature.
<FeatureSiteTemplateAssociation Id="b8f334a0-1ffe-420d-b6e2-54a9faa6ba95" TemplateName="STS#0" />