Friday, November 2, 2012

List and event receivers.

In SharePoint 2010, you can handle no of events or actions with event handlers or event receivers.

 

There are different events which get triggered and can be classified as below.

  • List events
  • List item events
  • List email events
  • Web Events
  • List Workflow events
  • Feature events
Above events gets fire when there is any change, additions, deletion take palace on list, Sites, Site Collection, List items and so on. All these events can be classified as Synchronous and Asynchronous events. Synchronous events takes pace while action is being processing or simply before action gets complete and Asynchronous events takes place after action gets complete. For example Synchronous events are Itemadding, Itemdeleting and Asynchronous events are like Itemadded and Itemdeleted.

 

Typical scenario for where we can use these events are

  • Before adding data or item to the list data can be validated and cancel addition of item to the list.
  • Send email based on item data
  • Logging to the database for auditing purpose
Feature event receivers are same as that of list event receivers. You can write code for when feature activation, deactivation, installation, uninstallation happens. You can add entry to the web.config file for accessing a database while feature installation or and same can be removed on feature deactivation of uninstallation. So let’s get started with hands on with examples.



No comments:

Post a Comment