I had a customer who wanted to remove the menu option "Edit in SharePoint Designer" in the site action. It was not simply enough to disable edit in SharePoint Designer in central administration, for it does not remove the the menu item but make it just gray.
My first thought was to make a Hidde custom action, but it turns out that many of the items in the site action can not remove by a Hidde custom action. It turns out that the menu items in the site action is hardcore in the master pagen. eg. v4.master. So we have four solutions to the problem position.
1) We can remove the rights of the logged on user.
2) In v4.master file, remove the line 147 to 157th
3) Do some JavaScript that remove the menu item
4) Make a custom control or delegate control ala:
SPRibbon ribbonControl = this.Parent.Controls.Cast<Control>().First(c => (c is SPRibbon)) as SPRibbon; SPRibbonPeripheralContent ribbonPeripheralContent = ribbonControl.Controls[0] as SPRibbonPeripheralContent; SiteActions siteActions = ribbonPeripheralContent.Controls.Cast<Control>().First(c => (c is SiteActions)) as SiteActions; FeatureMenuTemplate featureMenuTemplate = siteActions.Controls[0].Controls[2] as FeatureMenuTemplate; Control editInSharePointDesigner = featureMenuTemplate.Controls.Cast<Control>().First(csd => (csd is MenuItemTemplate) && ((MenuItemTemplate)csd).Text.Equals("Edit in SharePoint Designer", StringComparison.InvariantCultureIgnoreCase)); featureMenuTemplate.Controls.Remove(editInSharePointDesigner);
No comments:
Post a Comment