Monday, March 19, 2012

Quick Notes: Retrieving Values in Event Receivers using BeforeProperties and AfterProperties

In SharePoint Portal development there are many scenarios where we need to develop event receivers.
So for accessing list item/ library item values, we need to use BeforeProperties and AfterProperties of SharePoint Event receivers. But some times they give empty or null values.
Below chart gives great understanding of which values are populated in BeforeProperties , AfterProperties and properties.ListItem objects.

For list:



List

BeforeProperties

properties.ListItem

AfterProperties

ItemAdding

Empty

Null

New Value

ItemAdded

Empty

New Value

New Value

ItemUpdating

Empty

Old Values

Updated Values

ItemUpdated

Empty

Updated Values

Updated Values

ItemDeleting

Empty

Original Values

Empty

ItemDeleted

Empty

Null

Empty

For library:


List

BeforeProperties

properties.ListItem

AfterProperties

ItemAdding

Empty

Null

Empty

ItemAdded

Empty

New Value

Empty

ItemUpdating

Old Values

Old Values

Updated Values

ItemUpdated

Old Values

Updated Values

Updated Values

ItemDeleting

Empty

Original Values

Empty

ItemDeleted

Empty

Null

Empty


The Synergy MOSS blog has explain this more clearly, please check here for more details.
Good Post on "SP 2010: How To – Event Receivers and Custom Error Pages" by Tobias Zimmergren . 
http://zimmergren.net/technical/sp-2010-how-to-event-receivers-and-custom-error-pages

1 comment:

  1. Did you hear there is a 12 word phrase you can speak to your man... that will induce intense emotions of love and instinctual appeal for you buried inside his heart?

    That's because hidden in these 12 words is a "secret signal" that fuels a man's instinct to love, idolize and look after you with his entire heart...

    12 Words Will Fuel A Man's Desire Response

    This instinct is so built-in to a man's genetics that it will make him work harder than before to do his best at looking after your relationship.

    Matter of fact, triggering this all-powerful instinct is so mandatory to having the best ever relationship with your man that the moment you send your man a "Secret Signal"...

    ...You'll soon find him expose his soul and mind to you in a way he's never experienced before and he will identify you as the one and only woman in the universe who has ever truly interested him.

    ReplyDelete