In the development of SharePoint, there are often customers mentioned that the site operation of too many columns, in fact, we can be added through the feature way, but also through the server-side object model of the way to add; below, let me use a simple example, to introduce you;
1, Operation Siteaction, add "add by Linyu", hide "Site Settings", effects such as:
2, I am through the way of WebPart, modify the current page of the menu, code:
To put it simply, the Visible property is a hidden property, we can set whether the menu is displayed, sequence is the order of the menu in the group, if there is more than one menu in a group, the MENUGROUPID is the ID of the group, I set it to 1, so it appears on the top. ;
In addition to these, AddMenuItem method inside, you can also set the permissions of the menu, the specific can try it yourself;
3, the complete code, convenient for everyone to copy and paste the experiment, as follows:
Microsoft.SharePoint.WebControls.SiteActions siteaction =Microsoft.SharePoint.WebControls.SiteActions.GetCurrent ( This. Page);if(Siteaction! =NULL&& ribboncollection.length >0){ string[] RibbonID = Ribboncollection.split (';'); for(inti =0; i < ribbonid.length; i++) { //Hide Site ActionSiteaction.getmenuitem (Ribbonid[i]). Visible =false; } //Add Site ActionSiteaction.addmenuitem ("Menuitem_custom","Add by Linyu","","A Test Menu", "/_layouts/15/settings.aspx",""); Siteaction.getmenuitem ("Menuitem_custom"). Sequence =1; Siteaction.getmenuitem ("Menuitem_custom"). Menugroupid =1;}
4, look at the Site Settings menu ID tips, in fact, many places in SharePoint ID, can be found, I simply try to find out the prefix zz11_ can be removed, Site Settings ID is "menuitem_settings";
Summary
There are a lot of things that can be customized in SharePoint, and all we have to do is choose the right way to make it easier and faster. Here we can encapsulate a WebPart to hide the ribbon and siteaction two menus, which is a very handy way.
Reference documents
Http://www.cnblogs.com/jianyus/p/3877919.html
Http://www.cnblogs.com/jianyus/p/3375613.html