views:

1548

answers:

2

I'm trying to find how a field's value has changed in an ItemUpdat**ing** event receiver. The particular field's display name and internal name is Regions.

As soon as ItemUpdating is hit, the value of the Regions field is identical for the following:

properties.AfterProperties["Regions"]
properties.BeforeProperties["Regions"]
properties.ListItem["Regions"].ToString()

I would expect the latter two to contain the old value but surely AfterProperties should be set correctly.

Does anyone know how I can obtain the changed value?

Update: The event handler is attached to a MOSS 2007 publishing Pages list.

A: 

Are you trying this in a List or Document Library ?

It will work Only on the Doc Lib Please refer to these MSDN and another on same subject

Kusek
Maybe I missed it but I'm not seeing anything in the MSDN article that describes this exactly. Also in your second link it states that the AfterProperties for ItemUpdating _is_ changed in both a list and document library. So they don't seem to help?
Alex Angas
+1  A: 

I've had a lot of trouble with event handlers on publishing pages libraries. Think it comes from their being other event handlers on there already for publishing. I had better success with updating, can you change to that or do you need the sync event to block the change ?

Elaine
I don't need to block, just change some values. I'll investigate further (maybe try ItemUpdated) and return with what I find. Welcome, by the way :)
Alex Angas
Changed to using ItemUpdated. All working fine, not even getting the 'page was changed by another person' error!
Alex Angas