I've bound and ItemUpdating event to a document library of a MOSS publishing site, I’m then trying to compare the Before and After properties.

When I amend the field in the UI I expect the two values to be different, however they are always the same - by that I mean the original value. AfterProperties does not hold the new value.

This is the code I am using…

string internalName = properties.ListItem.Fields["SchemeProvider"].InternalName;

string BeforeValue = properties.BeforeProperties[internalName]);
string AfterValue = properties.AfterProperties[internalName]);

if (BeforeValue != AfterValue)
    properties.cancel = true;
    properties.ErrorMessage = “you cannot change this field value”;

What I don’t understand is that the ItemUpdated Before and After Properties are correct, in that the values are different.

3 Answers 3


First of all, I would recommend having this page open at all times while developing an event receiver. The important part for you, is the Document library table:

Library         BeforeProperties    AfterProperties    properties.ListItem
ItemAdding      No value            No value           Null
ItemAdded       No value            No value           New value
ItemUpdating    Original value      Changed value      Original value
ItemUpdated     Original value      Changed value      Changed value
ItemDeleting    No value            No value           Original value
ItemDeleted     No value            No value           Null

Also, if you are going to try to compare Before/After values, watch out for these types: People fields, rich text fields (Note), and DateTime fields. I'm sure this is probably a subset so make sure you test.

  • That's what I found confusing, I was using that page when developing and the table states the AfterProperties value for ItemUpdating is the 'Changed Value' yet my code always has the Original Value, have I missed something?
    – Rob
    Jan 7, 2011 at 15:09
  • You know the AfterProperties subscript operator returns an object right? Shouldn't you be casting to a string or calling ToString()? Ex: (string)properties.AfterProperties[internalName] or properties.AfterProperties[internalName].ToString()
    – Kit Menke
    Jan 7, 2011 at 19:24

Have you tried:

string BeforeValue = properties.ListItem[internalName];


BeforeProperties is a weird beast, I try to avoid using it.

  • I did indeed (forgot to include that in the sample) but still no luck. Its enough to drive a person mad.
    – Rob
    Jan 7, 2011 at 14:24

you need to use itemupdating to get the current value and updated value

  • and user properties.AfterProperties["XX"]
    – Fatema
    Nov 14, 2016 at 11:33
  • properties.ListItem["XX"]
    – Fatema
    Nov 14, 2016 at 11:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.