Share via


How to Customize (Add, Delete or Replace ) the "Site Action" menu items in Publishing site

The "Site Action" menu items in the SharePoint are rendered by the "CustomAction" feature framework. The story remains same untill the "Publishing Infrastructure Feature" is activated... When the publishing feature is activated and the site becomes SharePoint Publishing site then the datasource for the "SiteAction" menu items are rendered from the XML file which resides in 12 \ Template \ Layouts \ EditingMenu \ SiteAction.xml.

You cannot modify this "SiteAction.xml" file as it is OOB file and as well changing this file will affect the behavior in the total farm. SharePoint provides you a way to override the menu items rendered through the "SiteAction.xml" file. You can find the "Editing Menu" folder in the Master page gallery of the SharePoint publishing site, In this folder you can find the "CustomSiteAction.xml" file without the entries.

You can render your custom "Console Node" in this "CustomSiteAction.xml" to Add, Delete or replace the OOB console node links in the "Site Action" menu. Every menu item in the SiteAction.xml file has been rendered as a "ConsoleNode" class. Copy the references and the structure from the OOB "SiteAction.xml" and place it in the "CustomSiteAction.xml" file in the master page gallery. In the "ConsoleNode", you need to mention the "ConfigMenu" property to mention whether you are adding or deleting or replacing the console node in the "Site Action" menu. The enumerator value for Adding, Deleting and replacing the node are Add,Delete and Replace respectively.

Open the "CustomSiteAction.xml" file from the master page gallery. To add a console node you just need to add a "ConsoleNode" with the "ConfigMenu=Add" entry under the structure tag of the "CustomSiteAction.xml" file. To delete and replace the existing console node from the "Site Action" menu you need to mention another property called "ChangedNodeID" to mention the node id of the OOB file which need to be deleted or replaced.

The following "CustomSiteAction.xml" file is the sample to replace the "Create Page" console node link with the custom "Create Page" link where the custom link will navigate you to the "CustomCreatePage.aspx".

<?xml version="1.0" encoding="utf-8" ?>
<Console>
<references>
<reference TagPrefix="cms" assembly="Microsoft.SharePoint.Publishing, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" namespace="Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions" />
</references>
<structure>
<ConsoleNode ConfigMenu="Replace" ChangedNodeID="wsaCreatePage" />
<ConsoleNode Action="cms:CreateNewPublishingPageAction" DisplayText="cms,siteactions_createpage_displaytext" Description="cms,siteactions_createpage_description" HideIfDisabled="true" UseResourceFile="true" MenuGroupId="100" Sequence="6000" IsSiteRelative="true" PermissionContext="CurrentList" ImageUrl="/_layouts/images/crtpage.gif" NavigateUrl="/_layouts/Customcreatepage.aspx" ID="wsaCreatePage1" />
</structure>
</Console>

In the above example , "ConfigeMenu" intimates that this "ConsoleNode" is replacing the OOB node "wsaCreatePage" with the new node "wsaCreatePage1" which redirects to the customcreatepage.aspx to create new publishing pages. Apart from this there are several other properties which can be set through the XML file itself such as "userRights" for permission mask etc. You can find more details about other properties here.

Save the "CustomSiteAction.xml" file in the master page gallery. Do an IISRESET and you can find your custom "Create Page" link which replaced teh OOB link and will navigate you to the "CustomCreatePage.aspx" to create the publishing pages.

You can refer more about the "ConsoleNode" and "SiteAction.xml" file in the following MSDN article.

https://msdn.microsoft.com/en-us/library/aa674506.aspx

You can find my another blog on how to create the "CustomCreatePage.aspx" application page to store the publishing pages in various lists rather than only in Pages list.

                                                                          HAPPY CUSTOMIZING

Comments

  • Anonymous
    April 22, 2010
    the costomization we do in this CustomSiteAction.xml is reflecting only in the top site, sub sites are still showing the OOB menu items

  • Anonymous
    May 27, 2010
    Site Actions menu is working properly but you will always end up creating page at the root of your site collection. Problem is caused by this: NavigateUrl="/_layouts/Customcreatepage.aspx". Better solution is to put it this way: NavigateUrl="../_layouts/Customcreatepage.aspx". This is doing the thing in most situations (note that two dots are handling the pages -list reference properly from the url). Also since most of the MOSS's admin pages are located immediately under the _layouts folder, this is working properly from admin pages also. Anyway this solution is not rock solid since there might be cases when you'll end up creating the page to wrong location. Does anyone have a proper solution for solving this problem? Ofcource some kind of html module could solve this but I kinda hope for a solution which clearly seems the answer that sharepoint developers have thought for implementing this.

  • Anonymous
    October 16, 2011
    The comment has been removed

  • Anonymous
    November 16, 2011
    Hi. I write from Argentina! This is a very good post. But, I've sharepoint 2010, how can do this customizing for share point 2010? I need add new pages into document libraries Thanks

  • Anonymous
    December 04, 2011
    Hi, Nice Post !! We can also add custom fly out menus in the ‘Site Actions’ menu. Here’s the post which describes how this can be done for SharePoint 2010: www.directsharepoint.com/.../creating-custom-fly-out-menu-sharepoint.html

  • Anonymous
    August 23, 2012
    i have done the changes in customsiteaction.xml file and upload into sharepoint site for deleting New Document Library item. But there is no changes in the site. Please any one help me.