Monday, May 30, 2011

SharePoint foundation: deploy a event handler for custom list

There are severals methods to deploy event handler in SharePoint:
(1) deploy through Visual Studio 2010
(2) deploy solutions through stsadm command

Link an event handler to a specific list
When you create an evnet handler, you cannot find any custom list name in event source.


You select Custom List and press button Finish. After the creation of event handler, you can double click the Elements.xml under EventReceiver1.


Then, you need to change the line from

       <Receivers ListTemplateId="104">

to

      <Receiver ListUrl="List/helloWorld">

 Now, the event handler is linked to the list helloWorld


Deploy the event handler through Visual Studio 2010




There is only one step you need to do: right click the solution and select Deploy. Then, Visual Studio 2010 will deploy and activate the solution automatically.

Deploy the event handler though stsadm

(1) add solution

(2) deploy solution
   
(3) activate the solution


     Go to Site Settings -> Manage site features and press button Activate for the solution


Reference: http://patrickboom.wordpress.com/2010/05/31/using-powershell-to-deploy-sharepoint-solutions-wsp-2/

No comments:

Post a Comment