Tuesday, July 20, 2010

Understanding Feature activation dependencies !

Hi All,

When you create the feature, it can also include the dependencies. Let’s say, we have one feature that is dependent on the other feature, that means when we activate one feature, it actually requires the other feature already been activated, at that time we can use this feature dependencies.

A very good example of this is TeamCollab feature which activates many other features automatically. It creates several list templates and makes it available for the site.

Let me give you a very simple example of Feature Dependencies.

xmlns={namespace} />


<ActivationDependency FeatureId = {dependent Feature GUID}/>


That means the feature inside the ActivationDependency must be activated before the main feature gets activated.

If the main feature is A and inside ActivationDependency we write feature B, then activating Feature A first activates feature B and then activates feature A.

Note that Feature B must be installed first at specific scope.

Other very important thing to note here is you must have to define feature B (Feature that goes inside ActivationDependency) as Hidden, otherwise SharePoint will throw error saying that the dependant feature is not enabled.

That's it. your job is done.

No comments:

Post a Comment