4

I have two features that add CustomAction to the SiteSettings page. One feature is at the Site level and the other is at Web level.

The CustomAction that is being added at the Site level is a link to the custom configuration page that manipulates Site level settings for my application. Therefore, I don't want the link displayed for the SiteSettings page of a subsite. I know there is a setting (RequireSiteAdministrator) that hides the page according to access level, but I would still like to have this page show up for Site owners at the top/root level site settings page and not in the sub site level setting page.

There is a RootWebOnly attribute for the CustomAction xml node which would solve my problem. The problem with this attribute is that it only available for SandBoxed solutions.

I know that this is possible, since I see the behavior for the Site collection administrators link in the Users and Permissions section of the Site Settings page. Please notice that if you go to the top/root level settings page, you will see this link. On the other hand, if you navigate to the Site Settings page of a subsite, the link is no longer there.

I have tried using HideCustomAction, but this hides the link on both pages.

2 Answers2

3

After battling with this for two day, I had an ah moment that I thought I would share. This will allow you to place a custom action that will show only at the root web level.

Create 2 features. One at the site level (siteFeature) and one at the web level (webFeature). Make the web feature hidden so that it can't be accessed (activate/deactivate) though manage features page. Put the custom actions element xml in the web feature. In the activation event receiver of the site feature, activate the web feature.

0

UnfortunlyUnfortunately this is not possible with custom actions and custom group.

All you can do is just to set up permissions on the link that will be shown only to SiteCollection Administrator

Example how it will be is "Site Collection Administation" group where links are hidden when you are not on the top site level and shown when you are.

Hope it helps,

Andrew

Andrew Adamich
  • 707
  • 4
  • 8