Creating new CustomActionGroups for CustomAction items

I recently wanted to add some links to the Site Settings page of a SharePoint 2010 server when installing a custom feature.  By default there were seven groups available to choose from where I could place my feature related links, on my environment these were as follows:

  • Users and Permissions
  • Galleries
  • Site Administration
  • Site Collection Administration
  • Look and Feel
  • Site Actions
  • Reporting Services

When adding new links via a CustomAction it is possible to choose the location for the links by supplying a Location and GroupId attribute in the CustomAction XML.  In order to add links to the Site Settings page the Location attribute needs to be set to Microsoft.SharePoint.SiteSettings (a full list of available locations can be found by following the links at the end of this post).  Then the GroupId can be set to one of the predefined groups (i.e. SiteAdministration, SiteCollectionAdmin, UsersAndPermissions etc).

I did not however wish to add my links to any existing group, instead I wanted to create a brand new group relating to my new custom feature.  In order to create a new group it is possible to add a CustomActionGroup element to the feature’s Elements.xml file as follows.

<CustomActionGroup
Id=”CustomFeatureGroup”
Title =”Custom Feature Links”
Sequence=”1000″                                                                                   Location=”Microsoft.SharePoint.SiteSettings”
ImageUrl=”/_layouts/images/IMAGE_NAME.PNG”>
</CustomActionGroup>

I think the attributes above are reasonably self-explanatory but the important thing to note is the Id attribute.  This is the value our CustomActions must use in order to be added to this new group, as follows:

<CustomAction
Id=”CustomFeatureLink”
GroupId=”CustomFeatureGroup”
Location=”Microsoft.SharePoint.SiteSettings”
Sequence=”1000″
Title=”Custom Feature Settings”>
<UrlAction
Url=”/_layouts/CstmFeat/settings.aspx”/>
</CustomAction>

When the above feature is activated a new group would be created in Site Settings called Custom Feature Links which would have one link beneath it called Custom Feature Settings which links to the /_layouts/CstmFeat/settings.aspx page.

The only other thing to note is that in SharePoint 2010 the CustomActionGroup element can take an ImageUrl attribute and this is the large icon that will be displayed next to the group, in this case on the Site Settings page.  It is possible to either use a custom image or reuse one of the existing images supplied with SharePoint.

The following links may be useful for further information about CustomAction and CustomActionGroup usage:
CustomAction Element
Default Custom Action Locations and IDs
CustomActionGroup Element (Custom Action)

Advertisements
This entry was posted in MOSS, SharePoint, SharePoint 2010, XML and tagged , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s