How to add a custom action in the actions menu in the list of SharePoint 2007
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.
[Section 1]
<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=1.0.0.0, 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.
Hey, wanted to take a look at the source you posted, but it redirects me to a JPG. Do you still have it posted somewhere? Looks pretty cool!
Thanks!
Hi Jason,
Sorry for the mistake, here you can download the source code of this post and the others.
http://cid-ecd2400fababc2e2.skydrive.live.com/browse.aspx/C%c3%b3digo%20Blog
Thanks,
HI,
I deployed your solution onto my server, but nothing has been added to the custom action list. I went to activate the feature, and it is not even listed. Where may I have gone wrong?
HI,
Did run the command IISRESET? Try to do that and reload the page again.
Hi Imaz,
I tried your above solution, everything is working fine except that nothing is happening when click the custom action ? any idea why the c# script is not running
Hi,
Try doing an IISREST, probably the DLL's didn't was load very well, if not ping me again
Thank you very much for this nice article.
Thank you so much for this nice article
you're welcome 🙂