Showing posts with label Site Actions Menu. Show all posts
Showing posts with label Site Actions Menu. Show all posts

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;  
  }
 }
}