2

I want to upgrade the look-and-feel of a solution I'm working on. Right now the Administrators have an additional option in the Site Actions menu where I've added a Custom Action which takes them to a system page with a list of all the hidden lists specific to the configuration of their solution.

Instead of having them go to a mile long page with nothing but links, I would like to create a custom Site Action that works kind of how Nintex's custom Site Action works: the flyout menu.

How can I make Custom Actions with submenus like that?

Image for reference:

enter image description here

1 Answer 1

2

You will need to create a "custom action".

<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<CustomAction 
    Id="{42550415-FD08-4f1f-BAE6-93CCB2A2DE60}"
    Location="Microsoft.SharePoint.StandardMenu"
    GroupId="SiteActions"
    ControlAssembly="DemoCustomAction"
    ControlClass="DemoCustomAction.ListSettingsMenu">
</CustomAction>

namespace DemoCustomAction
{
public class ListSettingsMenu: System.Web.UI.WebControls.WebControl
{
    protected override void CreateChildControls()
    {
        SubMenuTemplate listSettings = new SubMenuTemplate();
        listSettings.Text = "List Settings";
        listSettings.Description = "Manage settings for lists on this site";
        listSettings.ImageUrl = "/_layouts/images/lg_ICASCX.gif";

        foreach (SPList list in SPContext.Current.Web.Lists)
        {
            if (!list.Hidden)
            {
                MenuItemTemplate listItem = new MenuItemTemplate();
                listItem.Text = list.Title;
                listItem.Description = string.Format(
                    "Manage settings for {0}", list.Title);
                listItem.ImageUrl = list.ImageUrl;

                string url = string.Format(
                    "{0}/_layouts/listedit.aspx?List={{{1}}}",
                    SPContext.Current.Web.Url, list.ID.ToString());
                listItem.ClientOnClickNavigateUrl = url;

                listSettings.Controls.Add(listItem);
            }
        }

        this.Controls.Add(listSettings);
    }
}
}

source: http://weblogs.asp.net/jan/creating-hierarchical-menus-with-a-customaction-in-sharepoint

other links:

http://www.c-sharpcorner.com/uploadfile/anavijai/how-to-add-an-item-to-the-site-actions-menu-in-sharepoint-2010/

http://blogs.msdn.com/b/vssharepointtoolsblog/archive/2010/02/18/adding-actions-to-site-actions-menu.aspx

http://gilleslauwers.wordpress.com/2011/11/22/add-custom-action-in-site-actions-menu-at-a-specific-location/

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.