SharePoint – Adding ECB Menu Item for Specific Custom List

Occassionally when creating a WSS 3 Feature you will be deploying into an environment that has grown “organically” and now requires some functionality to be developed beyond the capabilities of the standard SharePoint web interface or SharePoint Designer. In this case, we had a requirement to add a menu item to the menu that appears for each item in a SharePoint list – the “ECB” (Edit Control Block) menu (the “Send to Administration” link below):

sharepoint-ecb-menu-customised

Whilst you can easily create a menu item that appears only for a generic type of list (by using a RegistrationType of “List” and RegistrationId of “100” for all lists, or “101” for document libraries for instance), and you can also create a menu item for a specific content type (by using a RegistrationType of “ContentType” and a RegistrationId of “[all digits after ctype= parameter]”), it’s not immediately obvious how to generate an ECB Menu item for a SPECIFIC custom list.

The way you do this is to:

  1. Select the list that you want to add the ECB Menu item to
  2. From the Settings menu, click List Settings
  3. Click “Advanced Settings”
  4. Select the Yes radio button on the “Allow management of content types”
  5. Click OK
  6. Click on the newly created “Item” content type
  7. Copy the “ctype” value in the browser address bar (e.g. 0x0100EACBEA0833066E46A0984D0737CBE5EE in my case)
  8. Copy this value into the RegistrationId attribute, and set the RegistrationType attirbute to be “ContentType” your the elements.xml file where your feature is registered
  9. Install and activate your feature, and that’s it.

Example of what part of your elements.xml file will look like:

	<CustomAction Id="CampaignOpp.SendToAdministration"
		RegistrationType="ContentType"
		RegistrationId="0x0100474BBA4EC75C724FB75F41D8E6E4E29801"
		ImageUrl="/_layouts/images/32316.GIF"
		Location="EditControlBlock"
		Sequence="240"
		Title="Send to Administration" >
		<UrlAction Url="~site/_layouts/MyFeature/SendToAdministration.aspx?ItemId={ItemId}&amp;ListId={ListId}"/>
	</CustomAction>

You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

9 Comments »

 
 

Leave a Reply

You must be logged in to post a comment.