Sharepoint Adding event handler to the list with the help of a generic Console Application

Hi,

 

While working with Sharepoint list many a times developers need to create special event handler for the list based on their requirement. Once the event handler assembly is created we have to deploy the Assembly in GAC. And then attach the event handler to the list for which the event handler is created.

 

For attaching an event handler with the list we need to create a console application which would be used to attach the event handler to the list. Normally developers create separate console application to attach event handler to the different list.

 

What we can easily do create a single console application which would take some parameter form a configuration file and attach the event handler with the specified list. Developers need to provide the required data to attach the event handler in the configuration file.

 

The zipped console application is available here.

 

The console application does the work of attaching the event handler to the list. The console application needs 5 different values from the appsettings section of the configuration file.
  • SiteCollectionURL - Takes the URL of the Site where the list resides. Example – “http://www.example.com
  • RecordListName – Takes the name of the list on which the event handler should be attached. Example – “ListOfFriend”
  • EventHandlerName – Name of the eventhandler that should be applied like ItemUpdating. If there are more than one event handler, then user can pass the venet handler as a comma seperated list ItemDeleting,ItemUpdating
  • ClassName – FullName of the class where the code for the event handler has been written. Example – SharePoint.Vikram.EventHandlers.FriendList
  • AssemblyName – Name of the assembly where the class for the event handler - SharePoint.Vikram.EventHandlers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=faeb5f91b6c4621e

 

Vikram

4 Comments

Comments have been disabled for this content.