Within SharePoint 2010, there is a ‘context menu’ that is shown when you click on a specific file – eg. DOCX.
This is actually known as the “Edit Control Block” or ECB. Yep – another acronym for the kitbag.
To add functionality to the SharePoint 2010 ECB, we have to create a new SharePoint feature, with some XML within an ELEMENTS.XML file.
Here’s the steps to follow :
- Open Visual Studio 2010
- Click on “Empty SharePoint Project”
- Name the project : NewContextMenuButton
- Choose to ‘deploy as a farm solution’ when prompted
Within the new project, we need to add a new ‘elements’ file – and subsequent feature, etc.
- Right-click on the project, and choose Add > New Item
- Choose ‘Empty Element’
- Enter the name as : NewContextMenuButton
- Click CTRL+A (select all) and then Delete.
- Paste in the following XML
Description=”Click this button to see something magical occur…” >
You can now simply right-click – and choose DEPLOY – that’s it…! The feature & package name will be the default values – but they can be changed if needed.
Also – the IMAGE being used was just something that I found in the ‘layouts’ area of SharePointRoot.
Here’s the new Context Menu item – sorry, new addition to the Edit Control Block :
This will create a new entry for “DOCX” files – based on the “RegistrationType”.
You can also register for a specific Content Type, or ProgId – more information is available :
- CustomAction Element
- If wanting to register to specific list ‘types’ : SharePoint: RegistrationId List Template Type IDs
Next : How to call code – ie. do something useful !