Monday, May 13, 2013

SharePoint 2010 Menu IDs

I have found this interesting article about sharepoint 2010 menu hiding.

Menus in 2010? Isn't there a ribbon now?

SharePoint 2010 has ribbons everywhere… except for the Picture libraries and Surveys. Those two lists seem to have been overlooked in the upgrade process. Also the Site Actions button and the Welcome button still display menus and use the same techniques as commonly documented for SharePoint 2007 to hide, show and manipulate these menus.
If you are writing client side JavaScript code to interact with the SharePoint menus you will need to know the IDs of the <ie:menuitem> tags. Below are several tables with some of the IDs used by menu items. Remember that in the SharePoint page these will include a prefix that might look like "zz22_" or “ct100_”.
If the ID you need is not listed in the tables below then view the source of your SharePoint page and search for the name of the menu item (“Edit Page”) or the text "ie:menuitem" until you find the one you need.
  image
You would then find the menu item using JavaScript or jQuery routines such as the examples below. Add the code to a single page using a Content Editor Web Part or SharePoint Designer, or add the code to the master page to impact all pages in the site.

JavaScript:
<script type="text/javascript">
 var doc = document.getElementsByTagName('ie:menuitem'); 
 for (var i = 0; i < doc.length; i++)
  {
    itm = doc[i];
    if (itm.id.match('OpenInExplorer') != null)
      {
        itm.hidden=true;
        break; 
      }
  } 
</script>

jQuery:
$('ie\\:menuitem[id*=OpenInExplorer]').attr("hidden","true")

The is a list of items created in a typical Team Site home page (v4.master) for the Site Actions and Welcome menus:
Menu ID nameMenuMenu text
ID_ersonalInformationThe Welcome menuMy Settings
ID_LoginAsDifferentUserThe Welcome menuSign in as Different User
ID_RequestAccessThe Welcome menuRequest Access
ID_LogoutThe Welcome menuSign Out
MenuIItem_EditPageSite ActionsEdit Page
MenuItem_TakeOfflineSite ActionsSync to SharePoint Workspace
MenuItem_CreatePageSite ActionsNew Page
MenuItem_CreateDocLibSite ActionsNew Document Library
MenuItem_CreateSiteSite ActionsNew Site
MenuItem_CreateSite ActionsMore Options…
MenuItem_ViewAllSiteContentsSite ActionsView All Site Content
MenuItem_EditSiteSite ActionsEdit in SharePoint Designer
MenuItem_SitePermissionsSite ActionsSite Permissions
MenuItem_SettingsSite Actions Site Settings


This is a list of menu items created by a picture library view page:
(all of the above table plus the following)
Menu ID nameMenuMenu text
NewFolderNewNew Folder
   
_Upload (1)UploadUpload Document
MultipleUploadUploadUpload Multiple Pictures
   
EditPicturesActionsEdit
DeletePicturesActionsDelete
DownloadPicturesActionsDownload
SendPicturesActionsSend To
ViewSlideShowActionsView Slide Show
OpenInExplorerActionsOpen with Windows Explorer
OfflineButtonActionsConnect to Outlook
TakeOfflineToClientActionsSync To Computer
ViewRSSActionsView RSS Feed
SubscribeButtonActionsAlert Me
   
AddColumnSettingsCreate Column
AddViewSettingsCreate View
ListSettingsMenu_tSettingsSettings
   
ModifyViewViewModify this view
CreateViewViewCreate view

(1) Prefix the keyword "Upload" with the underline to not confuse with "MultipleUpload"

Mike Smith's Tech Training Notes: SharePoint 2010 Menu IDs