Wednesday, May 1, 2013

SharePoint Site Actions Menu: Hide Sync to Workspace and Edit in SharePoint Designer

In my environment, I do not want to show users the Site Actions menu options that allow them to sync to workspace or click on Edit in SharePoint Designer.

I created this script that would iterate the menu options and hide the ones I didnt want available


ExecuteOrDelayUntilScriptLoaded(HideSiteActionMenuItems, "SP.Ribbon.js");


function HideSiteActionMenuItems()
{
 var menuItems = document.getElementsByTagName("ie:menuitem");
 if( menuItems != null )
 {
  for( var i = 0; i < menuItems.length; i++ )
  {
   var keyId = menuItems[i].id;
   if(keyId.endsWith("MenuItem_TakeOffline"))//Hide Sync to SharePoint Workspace
    menuItems[keyId ].hidden = true;
   else if( keyId.endsWith("MenuItem_EditSite")) //Hide Edit in SharePoint Designer
    menuItems[keyId].hidden = true;  
  }
 }
}

 



1 comment:

  1. Would there be a simple way to add a permissions modifier to this script? In my case, I would like to do this for my guests as I am giving them a portal / simple page, while the same page is more useful for my members.

    Thank you for the script, such a simple and focused solution.

    ReplyDelete