Custom Context Menu Item in SharePoint 2010

You can modify content menu of list items in SharePoint 2010. List items’ context menu is called as Edit Control Block (ECB).

  1. Create a “SharePoint Project” in Visual Studio 2010 (farm solution)
  2. Add new “Feature”.
  3. Set the scope of “Feature” according to your needs.
  4. Add new “Empty Element” to your solution.
  5. In Elements.xml file add the following <CustomAction> element. Registration type specifies when te context menu appears. Following two xml code samples define custom action for a list item and a specific file type.

[crayon lang=”xhtml”]

Id=”SampleId”
RegistrationType=”List”
RegistrationId=”101″
Location=”EditControlBlock”
Sequence=”301″
Title=”Sample item context menu”>
[/crayon]

 

[crayon lang=”xhtml”]

Id=”SampleId”
RegistrationType=”FileType”
RegistrationId=”docx”
Location=”EditControlBlock”
Sequence=”301″
Title=”Sample docx file context menu”>
[/crayon]

Some notes:

  • RegistrationType possible values
    • None
    • List
    • ContentType
    • ProgId
    • FileType
  • RegistrationId specifies Edit Content Block category that the custom menu item will displayed. You can find the full list of possible RegistrationId values on Mike Smith’s blog.
  • <UrlAction> element defines the URL to a SharePoint page that will be displayed when user clicks on the custom menu item.
  • Full CustomAction Details: http://msdn.microsoft.com/en-us/library/ms460194.aspx

Leave a comment

Your email address will not be published.

One thought on “Custom Context Menu Item in SharePoint 2010”

%d bloggers like this: