Friday, February 11, 2011

Events enhancements to SharePoint 2010

There are many new events added in this version of SharePoint. Added events for lists, webs and there is support for synchronous after events. With these new approaches in this events infrastructure it is more easy to code than the earlier versions.

At high level events added are:

  1. On List: added events for adding and deleting
  2. On Web: added event for adding
  3. After events can be either synchronous or asynchronous.

Other than above three there are new capabilities added to the existing event functionality. They are:

  • Register events in site collection level
  • Improved semantics for retrieving event data
  • Improved UI for form-level events
  • XML event registration at the site receiver: This is completely a new thing in event registration. You can register an event to the site level or web level. In the feature xml file we have to use the “Scope” attribute to either “Web”[Web site] or “Site” [Site collection]. The default value will be site level.

On List:

  • ListAdding(SPListEventProperties): This will be fired when a new list is getting created.
  • ListAdded(SPListEventProperties): This will be fired after a list is created in database.
  • ListDeleting(SPListEventProperties): This will be fired when a list is deleting.
  • ListDeleted(SPListEventProperties): This will be fired after a list is deleted from database.

On Web:

  • WebAdding(SPWebEventProperties): This will be fired before a new site is getting created.
  • WebProvisioned(SPWebEventProperties): This will be fired after web site is successfully created and provision processed successfully. This will work either in synchronous mode or asynchronous mode.

Synchronous after events:

These are a bit difficult to understand. Microsoft explained them as “When a list item is submitted to created in database and before user actually see them. When synchronous after events occur, the event is processed before the event handler relinquishes control.” So usually the default synchronization behavior is  synchronous for before events and asynchronous for after events.

No comments:

Post a Comment