In today's class , I was explaining about how to create a new feature receiver and some one asked me an interesting question about how to activate a feature on Central Administration Web Application.
Solution :
I start digging it and found something really interesting. Feature schema exposes a property name AutoActivateInCentralAdmin. Once set it to TRUE , it will be activated on Central Administration.
Now before you really start jumping , keep in mind that this will not restrict the feature to show up in other Web Application in which it was deployed and can be activated or deactivated. So if you really wanted a feature to be effective for only Central Administration then you need to check in Feature Activation event.
<?xml version="1.0" encoding="utf-8"?>Article:
<Feature Id="GUID" Title="ContentType1" Scope="Site" Version="1.0.0.0" Hidden="FALSE" DefaultResourceFile="core" AutoActivateInCentralAdmin="TRUE"> xmlns="http://schemas.microsoft.com/sharepoint/"
<ElementManifests>
<ElementManifest Location="ContentTypeX\ContentTypeX.xml" />
</ElementManifests>
</Feature>
MSDN
As per MSDN : TRUE if the Feature is activated by default in the Administrative Web site, site collection, or Web application. This attribute equals FALSE by default. The AutoActivateInCentralAdmin attribute does not apply to Farm-scoped Features.
0 comments:
Post a Comment