In this article we are going to review how we can create a new action option in the actions options menu in a list of SharePoint as can see in Image 1. To create this project I’m using the last version of WSPBuilder from Codeplex.
The first task that we need to do is create a new project using the template installed by WSPBuilder installer. Once the project was created we must add a new item to the project using other template. This option must be a blank feature then we are going to find a BlankFeature template in the templates available to create our feature. The project in Visual Studio 2008 should be as we can see in Image 2.
The next step is to create a class (CustomActionListClass) in the root of the project as we can see in Image 1 and this class must inherit from WebControl of Asp.Net because we are creating a custom control to handle the action event.
The last step is to modify the XML elements.xml to add the CustomAction node and the options needed to create our actions. In Section 1 we can see the XML needed to do that.
<Elements xmlns="http://schemas.microsoft.com/sharepoint/"><CustomActionId="ExportViewToPdf"Title="Export to Pdf"Description="Export to Pdf the content of selected view"GroupId="ActionsMenu"Location="Microsoft.SharePoint.StandardMenu" ControlAssembly="Siderys.Blog.Navegation.CustomActionList,Version=188.8.131.52, Culture=neutral, PublicKeyToken=711eed342842acee" ControlClass="Siderys.Blog.Navegation.CustomActionList.CustomActioinListClass"RegistrationType="List"Sequence="100"></CustomAction></Elements>
As we can see in the XML we are adding to special node, ControlAssembly and ControlClass. These nodes are using to set the assembly and the class that we are using to create de control and handle the action when the users select it.
Once the package was installed and the feature was activated we can see our option in the actions menu of each list because we are adding this option for all list as you can see in the node RegistrationType.