Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 890
  • Last Modified:

How can I compare before and after values on Item updating/updated

Is there a way that I can compare before and after values of a custom 'people or group' field using an event receiver.

I am currently using the Item_Updating event and cannot seem to get to the custom value from the SPItemEventProperties. All I am getting is null or 1 in the after properties.

I am trying to figure out if the Assigned To field has changed and if so I need to reassign permissions based on the new Assigned To user.
1 Solution
IIRC (it's been a while since I created an eventhandler) you can compare the beforeproperties to the current properties of the item to see if something has changed.

So something like item.BeforeProperties["assignedto"] == item["assignedto"];

Try using this. modify as per your needs. Hope it works :)

public override void ItemAdding(SPItemEventProperties properties)


            string toolTipFieldInternalName = "";

            using (SPWeb web = properties.OpenWeb())


                toolTipFieldInternalName = web.Lists[properties.ListId].Fields[TOOL_TIP_FIELD_NAME].InternalName;




            string urlVal = properties.AfterProperties["URL"].ToString();

            SPFieldUrlValue val = new SPFieldUrlValue(urlVal);

            string desc = val.Description;

            properties.AfterProperties[toolTipFieldInternalName] = desc;



Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now