1

I want to add a Site Actions icon to my custom master page in SharePoint 2013

In my HTML code : I put the tag ( class="ms-siteactions-root" id="siteactiontd" ) (iIfound it with firebug, I already added the ms-help without a problem) and in design manager I have the following error :

ie : is an undeclared prefix

here is the code that I added :

<span class="ms-siteactions-root" id="siteactiontd">

<span style="display:none"><menu type="ServerMenu" id="zz9_SiteActionsMenuMain" hideicons="true"><ie:menuitem id="zz10_MenuItem_ShareThisSite" type="option" onmenuclick="EnsureScriptFunc('sharing.js', 'DisplaySharedWithDialog', function () { DisplaySharedWithDialog('\u002f'); })" text="Shared with..." description="See who's here and invite new people." menugroupid="100" enabled="true" checked="false" onmenuclick_original="EnsureScriptFunc('sharing.js', 'DisplaySharedWithDialog', function () { DisplaySharedWithDialog('\u002f'); })" text_original="Shared with..." description_original="See who's here and invite new people." valorig="
"></ie:menuitem>
<ie:menuitem id="zz11_MenuItem_CreatePage" type="option" iconsrc="/_layouts/15/images/NewContentPageHH.png?rev=23" onmenuclick="OpenCreateWebPageDialog('\u002f_layouts\u002f15\u002fcreatewebpage.aspx')" text="Add a page" description="Create a page you can customize." menugroupid="200" enabled="true" checked="false" onmenuclick_original="OpenCreateWebPageDialog('\u002f_layouts\u002f15\u002fcreatewebpage.aspx')" text_original="Add a page" description_original="Create a page you can customize." valorig="
"></ie:menuitem>
<ie:menuitem id="zz12_MenuItem_Create" type="option" onmenuclick="GoToPage('\u002f_layouts\u002f15\u002faddanapp.aspx')" text="Add an app" description="Create other types of pages, lists, libraries, and sites." menugroupid="200" enabled="true" checked="false" onmenuclick_original="GoToPage('\u002f_layouts\u002f15\u002faddanapp.aspx')" text_original="Add an app" description_original="Create other types of pages, lists, libraries, and sites." valorig="
"></ie:menuitem>
<ie:menuitem id="zz13_MenuItem_ViewAllSiteContents" type="option" iconsrc="/_layouts/15/images/allcontent32.png?rev=23" onmenuclick="STSNavigate2(event,'/_layouts/15/viewlsts.aspx');" text="Site contents" description="View all libraries and lists in this site." menugroupid="200" enabled="true" checked="false" onmenuclick_original="STSNavigate2(event,'/_layouts/15/viewlsts.aspx');" text_original="Site contents" description_original="View all libraries and lists in this site." valorig="
"></ie:menuitem>
<ie:menuitem id="ctl00_ctl00_ctl53_SiteActionsMenuMain_ctl00_wsaDesignEditor" type="option" iconsrc="/_layouts/15/images/designer.png?rev=23" onmenuclick="STSNavigate2(event,'/_layouts/15/DesignSite.aspx');" text="Design Manager" description="Change the look and feel of this site." menugroupid="300" enabled="true" checked="false" onmenuclick_original="STSNavigate2(event,'/_layouts/15/DesignSite.aspx');" text_original="Design Manager" description_original="Change the look and feel of this site." valorig="
"></ie:menuitem>
<ie:menuitem id="zz14_MenuItem_Settings" type="option" iconsrc="/_layouts/15/images/settingsIcon.png?rev=23" onmenuclick="GoToPage('\u002f_layouts\u002f15\u002fsettings.aspx')" text="Site settings" description="Access all settings for this site." menugroupid="300" enabled="true" checked="false" onmenuclick_original="GoToPage('\u002f_layouts\u002f15\u002fsettings.aspx')" text_original="Site settings" description_original="Access all settings for this site." valorig="
"></ie:menuitem>
<ie:menuitem id="ctl00_ctl00_ctl53_SiteActionsMenuMain_ctl00_ctl02" type="option" onmenuclick="STSNavigate2(event,'/GettingStarted.aspx');" text="Getting started" description="Get started with your site." menugroupid="2147483647" enabled="true" checked="false" onmenuclick_original="STSNavigate2(event,'/GettingStarted.aspx');" text_original="Getting started" description_original="Get started with your site." valorig="
"></ie:menuitem>
</menu></span><span id="zz15_SiteActionsMenu_t" class="ms-siteactions-normal" title="Settings" onmouseover="MMU_PopMenuIfShowing(this);MMU_EcbTableMouseOverOut(this, true)" hoveractive="ms-siteactions-normal ms-siteactions-hover" hoverinactive="ms-siteactions-normal" onclick=" CoreInvoke('MMU_Open',byid('zz9_SiteActionsMenuMain'), MMU_GetMenuFromClientId('zz15_SiteActionsMenu'),event,true, null, 0); return false;" foa="MMU_GetMenuFromClientId('zz15_SiteActionsMenu')" oncontextmenu="ClkElmt(this); return false;"><a class="ms-core-menu-root" id="zz15_SiteActionsMenu" accesskey="/" href="javascript:;" title="Settings" onkeydown="MMU_EcbLinkOnKeyDown(byid('zz9_SiteActionsMenuMain'), MMU_GetMenuFromClientId('zz15_SiteActionsMenu'));" menutokenvalues="MENUCLIENTID=zz15_SiteActionsMenu,TEMPLATECLIENTID=zz9_SiteActionsMenuMain" serverclientid="zz15_SiteActionsMenu"><span class="ms-siteactions-imgspan"><img class="ms-core-menu-buttonIcon" src="/_layouts/15/images/spcommon.png?rev=23" alt="Settings" title="Settings"></span><span class="ms-accessible">Use SHIFT+ENTER to open the menu (new window).</span></a></span></span>

2 Answers 2

1

it should be within the masterpage, and not the rendered html but rather aspx ;)

        <SharePoint:AjaxDelta runat="server" id="DeltaSuiteBarRight" CssClass="ms-core-deltaSuiteBarRight" BlockElement="true">
            <SharePoint:SPSecurityTrimmedControl runat="server" AuthenticationRestrictions="AuthenticatedUsersOnly" EmitDiv="true">
                <div id="welcomeMenuBox">
  <wssuc:Welcome id="IdWelcome" runat="server" EnableViewState="false" />
                </div>
                <div id="suiteBarButtons">
                       <span class="ms-siteactions-root" id="siteactiontd">
                       <SharePoint:SiteActions runat="server" accesskey="<%$Resources:wss,tb_SiteActions_AK%>" id="SiteActionsMenuMain"
                        PrefixHtml=""
                        SuffixHtml=""
                        ImageUrl="/_layouts/15/images/spcommon.png?rev=23"
                        ThemeKey="spcommon"
                        MenuAlignment="Right"
                        MenuNotVisibleHtml="&amp;nbsp;"
                        LargeIconMode="false"
                        >
                        <CustomTemplate>
                        <SharePoint:FeatureMenuTemplate runat="server"
                            FeatureScope="Site"
                            Location="Microsoft.SharePoint.StandardMenu"
                            GroupId="SiteActions"
                            UseShortId="true"
                            >
                          <SharePoint:MenuItemTemplate runat="server"
                              id="MenuItem_ShareThisSite"
                              Text="<%$Resources:wss,siteactions_sharethissite%>"
                              Description="<%$Resources:wss,siteactions_sharethissitedescription%>"
                              MenuGroupId="100"
                              Sequence="110"
                              UseShortId="true"
                              PermissionsString="ViewPages"
                              PermissionMode="Any" />
                          <SharePoint:MenuItemTemplate runat="server" id="MenuItem_EditPage"
                              Text="<%$Resources:wss,siteactions_editpage15%>"
                              Description="<%$Resources:wss,siteactions_editpagedescriptionv4%>"
                              ImageUrl="/_layouts/15/images/ActionsEditPage.png?rev=23"
                              MenuGroupId="200"
                              Sequence="210"
                              PermissionsString="EditListItems"
                              ClientOnClickNavigateUrl="javascript:ChangeLayoutMode(false);" />
                          <SharePoint:MenuItemTemplate runat="server" id="MenuItem_CreatePage"
                              Text="<%$Resources:wss,siteactions_addpage15%>"
                              Description="<%$Resources:wss,siteactions_createpagedesc%>"
                              ImageUrl="/_layouts/15/images/NewContentPageHH.png?rev=23"
                              MenuGroupId="200"
                              Sequence="220"
                              UseShortId="true"
                              ClientOnClickScriptContainingPrefixedUrl="OpenCreateWebPageDialog('~siteLayouts/createwebpage.aspx')"
                              PermissionsString="AddListItems, EditListItems"
                              PermissionMode="All" />
                          <SharePoint:MenuItemTemplate runat="server" id="MenuItem_Create"
                              Text="<%$Resources:wss,siteactions_addapp15%>"
                              Description="<%$Resources:wss,siteactions_createdesc%>"
                              MenuGroupId="200"
                              Sequence="230"
                              UseShortId="true"
                              ClientOnClickScriptContainingPrefixedUrl="GoToPage('~siteLayouts/addanapp.aspx')"
                              PermissionsString="ManageLists, ManageSubwebs"
                              PermissionMode="Any" />
                          <SharePoint:MenuItemTemplate runat="server" id="MenuItem_ViewAllSiteContents"
                              Text="<%$Resources:wss,quiklnch_allcontent_15%>"
                              Description="<%$Resources:wss,siteactions_allcontentdescription%>"
                              ImageUrl="/_layouts/15/images/allcontent32.png?rev=23"
                              MenuGroupId="200"
                              Sequence="240"
                              UseShortId="true"
                              ClientOnClickNavigateUrl="~siteLayouts/viewlsts.aspx"
                              PermissionsString="ViewFormPages"
                              PermissionMode="Any" />
                          <SharePoint:MenuItemTemplate runat="server" id="MenuItem_ChangeTheLook"
                              Text="<%$Resources:wss,siteactions_changethelook15%>"
                              Description="<%$Resources:wss,siteactions_changethelookdesc15%>"
                              MenuGroupId="300"
                              Sequence="310"
                              UseShortId="true"
                              ClientOnClickNavigateUrl="~siteLayouts/designgallery.aspx"
                              PermissionsString="ApplyThemeAndBorder,ApplyStyleSheets,Open,ViewPages,OpenItems,ViewListItems"
                              PermissionMode="All" />
                          <SharePoint:MenuItemTemplate runat="server" id="MenuItem_Settings"
                              Text="<%$Resources:wss,siteactions_settings15%>"
                              Description="<%$Resources:wss,siteactions_sitesettingsdescriptionv4%>"
                              ImageUrl="/_layouts/15/images/settingsIcon.png?rev=23"
                              MenuGroupId="300"
                              Sequence="320"
                              UseShortId="true"
                              ClientOnClickScriptContainingPrefixedUrl="GoToPage('~siteLayouts/settings.aspx')"
                              PermissionsString="EnumeratePermissions,ManageWeb,ManageSubwebs,AddAndCustomizePages,ApplyThemeAndBorder,ManageAlerts,ManageLists,ViewUsageData"
                              PermissionMode="Any" />
                          <SharePoint:MenuItemTemplate runat="server" id="MenuItem_SwitchToMobileView"
                              Visible="false"
                              Text="<%$Resources:wss,siteactions_switchtomobileview%>"
                              Description="<%$Resources:wss,siteactions_switchtomobileviewdesc%>"
                              MenuGroupId="300"
                              Sequence="330"
                              UseShortId="true"
                              ClientOnClickScript="var mswlh = window.location.href; if (mswlh.indexOf('?')==-1) { window.location = mswlh + '?mobile=1'; } else { window.location = mswlh + '&mobile=1'; }" />
                        </SharePoint:FeatureMenuTemplate>
                        </CustomTemplate>
                      </SharePoint:SiteActions></span>
                    <span id="ms-help">
                        <SharePoint:ThemedClusteredHoverImage
                            runat="server"
                            ID="TopHelpLink"
                            ThemeKey="spintl"
                            TouchMode="true"
                            TouchModeWidth="30"
                            TouchModeHeight="30"
                            TouchModePaddingTop="7"
                            TouchModePaddingRight="7"
                            TouchModePaddingBottom="7"
                            TouchModePaddingLeft="7"
                            ImageUrl="/_layouts/15/~lcid/images/spintl.png"
                            Width="16"
                            Height="16"
                            OffsetX="19"
                            OffsetY="1"
                            HoverOffsetX="1"
                            HoverOffsetY="1"
                            NavigateUrl="#"
                            onclick="TopHelpButtonClick('HelpHome',event);return false"
                            AlternateText="<%$Resources:wss,multipages_helplink_text%>"
                            AccessKey="<%$Resources:wss,multipages_helplink_accesskey%>"
                            ToolTip="<%$Resources:wss,multipages_helplink_text%>" />
                    </span>
                </div>
            </SharePoint:SPSecurityTrimmedControl>
        </SharePoint:AjaxDelta>
11
  • I tried your exp, in my .master but nothing changes in my HTML or in Design manager (i mapped the driver so i have .html and .master files)
    – Ben Kraiem
    Apr 8, 2014 at 9:22
  • When I close and reopen the .master afteradding the code, I don't find what I added it's deleted
    – Ben Kraiem
    Apr 8, 2014 at 9:49
  • are you: downloading to local hdd, open up .master, makes changes, within /_catalogs/masterpage/Forms/AllItems.aspx upload the file, check in the new uploaded version and publish major version.... or are you doing it through spd?
    – Ali Jafer
    Apr 8, 2014 at 9:56
  • when I want to save there's a warning msg : the master page does not have any content regions defined, do you want to save anyway ? when I hit Yes and reopen the file, I don't find the code
    – Ben Kraiem
    Apr 8, 2014 at 10:06
  • ok, means you dont have any contentplaceholders within your masterpage? is your masterpage custom? can you show it here by ammending your question?
    – Ali Jafer
    Apr 8, 2014 at 11:01
0

I used JS to solve this, however it won't let me remove or hide the "Add an app" link.

SP.SOD.executeFunc('sp.js', 'SP.ClientContext', function () {
  var items = document.getElementByTagName('ie:menuitem');
    for (var i = 0; i < items.length; i++) {
        var item = items[i];
        if(item.id.match('CreatePage') != null) {
            item.hidden = true;
            item.parentNode.removeChild(item);
        }
    }
});

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.