You can modify content menu of list items in SharePoint 2010. List items’ context menu is called as Edit Control Block (ECB).
- Create a “SharePoint Project” in Visual Studio 2010 (farm solution)
- Add new “Feature”.
- Set the scope of “Feature” according to your needs.
- Add new “Empty Element” to your solution.
- 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
One thought on “Custom Context Menu Item in SharePoint 2010”
a screenshot could be good in here 🙂