Monday, March 3, 2014

How to manage CustomActionGroups with more than one feature

copyright from: www.stefan-walter.net

The problem

If you need a CustomActionGroup and link in the site settings, you can create them with a feature and its xml. But there is no way to manage the CustomActionGroups programmatically, if I am wrong on this point, tell me please!
So if I have two features which creates custom site settings links and groups, I get two CustomActionGroups (even with the same id). As workaround I created the following solution architecture to avoid this, but it’s not very handy.
If it’s possible use a base feature for things like constants, helper methods and things like CustomActiongroups because that approach would be much less work.
Solution Architecture

Solution architecture description

All my visual studio solutions contains three features. Two of the features are hidden and responsible for creating the CustomActionGroup and links, while the third is responsible for the business logic. Both of the hidden features contains a feature property which we need to identify the ‘partner’ feature (look at the xml files to know what I mean).
Feature 1: SiteSettingsGroup
When activating this feature, it creates the CustomActionGroup and the CustomAction (=link).
Feature 2: SiteSettingsLink
When activating this feature, it creates the CustomAction (=link).
Feature 3: Business logic
When activating this feature it activates, depending on necessity one of the other two, and provides the business logic for disposal, in this case my webpart.

No comments: