4/16/2011

SharePoint 2010 Menu IDs

 

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 name

Menu

Menu text

ID_ersonalInformation

The Welcome menu

My Settings

ID_LoginAsDifferentUser

The Welcome menu

Sign in as Different User

ID_RequestAccess

The Welcome menu

Request Access

ID_Logout

The Welcome menu

Sign Out

MenuIItem_EditPage Site Actions Edit Page
MenuItem_TakeOffline Site Actions Sync to SharePoint Workspace
MenuItem_CreatePage Site Actions New Page
MenuItem_CreateDocLib Site Actions New Document Library
MenuItem_CreateSite Site Actions New Site
MenuItem_Create Site Actions More Options…
MenuItem_ViewAllSiteContents Site Actions View All Site Content
MenuItem_EditSite Site Actions Edit in SharePoint Designer
MenuItem_SitePermissions Site Actions Site Permissions

MenuItem_Settings

Site 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 name

Menu

Menu text

NewFolder

New

New Folder

     

_Upload (1)

Upload

Upload Document

MultipleUpload

Upload

Upload Multiple Pictures

     

EditPictures

Actions

Edit

DeletePictures

Actions

Delete

DownloadPictures

Actions

Download

SendPictures

Actions

Send To

ViewSlideShow

Actions

View Slide Show

OpenInExplorer

Actions

Open with Windows Explorer

OfflineButton

Actions

Connect to Outlook

TakeOfflineToClient Actions Sync To Computer

ViewRSS

Actions

View RSS Feed

SubscribeButton

Actions

Alert Me

     

AddColumn

Settings

Create Column

AddView

Settings

Create View

ListSettingsMenu_t

Settings

Settings

     

ModifyView

View

Modify this view

CreateView

View

Create view

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

 

.

1 comment:

Milind Saraswala said...

I was looking on similar thing. Let me try and get back to you, if it works or not.

But nice way.

Note to spammers!

Spammers, don't waste your time... all posts are moderated. If your comment includes unrelated links, is advertising, or just pure spam, it will never be seen.