0

I am trying to get the BeforeProperties for an User field in a custom list on ItemUpdating or ItemUpdated Event Receiver. i always getting 'null' on the before value

String Olds = properties.BeforeProperties["PILOTE_x0020_ROCESSUS"].ToString();

SPFieldUserValue Old = new SPFieldUserValue(mySite, Olds);

OldUser = Old.User;
0

That's expected for standard lists (not document libraries). You can get the original value from properties.ListItem in ItemUpdating and the changed value from properties.AfterProperties.

I guess you are using claims based authentication. There are some differences what BeforeProperties for user field contains depending what type of authentication is used and depending is the field updated with the UI or programmatically. I have done some testing some time ago and included the results in my post

https://naimmurati.wordpress.com/2014/07/25/user-field-in-event-receivers-when-using-claims-based-authentication-and-classic-mode-authentication/

Your Answer

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

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