I am not able to get user field on AfterProperties in EventReceiver. I am using ItemUpdating event as I want to compare old value and new value. But I am getting error while fetching user field using properties.AfterProperties[fieldname].

 SPFieldUserValueCollection newValue = new SPFieldUserValueCollection(properties.Web.Site.RootWeb, Convert.ToString(properties.AfterProperties["fieldname"]));

In newValueI am getting -1;#i:0#,w|domain\user

Getting Id as -1

Below is the screenshot

enter image description here

  • what error do you get?
    – Gwny
    Commented Feb 16, 2016 at 11:09

1 Answer 1


Your problem here is that the user from afterProperties hasn't been ensured yet and therefore doesn't have the right ID from the Users List (-1).

You could solve your Problem by calling


for every user before using it in SPFieldUserValueCollection.

If you just need the login name you can use a normal SPFieldLookupValueCollection instead of SPFieldUserValueCollection.


 SPFieldLookupValueCollection newValues = new SPFieldLookupValueCollection (Convert.ToString(properties.AfterProperties["fieldname"]));

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.