Current Item Properties for Comparison within the ItemUpdating Event Receiver Event
June 18, 2009 2 Comments
Within an event receiver, you have two hash tables available to you within SPItemEventProperties, BeforeProperties, and AfterProperties.
When working with the ItemUpdating event receiver, the AfterProperties do indeed hold the updated values of that list item. However, the BeforeProperties hash table does not hold the current item values, which can lead you to some head scratching trying to figure out how to access these for comparison purposes.
Never fear – you can still get to it through the SPItemEventProperties through:
properties.ListItem.Fields[“Field Display Name”].InternalName
So you can compare that with your AfterProperties value:
properties.AfterProperties[properties.ListItem.Fields["Field Display Name"].InternalName]
And you’re good to go.
this saved my life. thank you
Glad to hear it helped you out!