1

I need to access the before and after field values for the list item corresponding to an event receiver in MOSS 2007. The name of the field is Annual Salary and the InternalName is Annual_x0020_Salary. I used the following code to determine the value of the field:

properties.BeforeProperties[properties.ListItem.Fields["Annual Salary"].InternalName] // yields null
properties.ListItem.Fields["Annual Salary"].InternalName // yields Annual_x0020_Salary
properties.BeforeProperties["Annual Salary"])); // yields 100000

I read that fetching the value via the internal name is best practice towards future-proofing the code base. But according to what I am seeing, I am not even able to access the value using the internal name. On the contrary, I am able to access the value via the display name. Is this expected behavior? This is for a document library, if that makes any difference.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.