1

I have an itemadded event receivers for a List, my ItemAdded function here:

public override void ItemAdded(SPItemEventProperties properties)
        {
            base.ItemAdded(properties);
            SPListItem item = properties.ListItem;
            string a= item["a"].ToString();
            string b= item["b"].ToString().Trim();
// Sure that 'b' is not empty
            if (String.IsNullOrEmpty(b))
            {
                item["b"] = a;
                item.Update();
            }

        }

But nothing happen after I added the item??? I'm a new in Event Receiver

2

Comment the line base.ItemAdded(properties); and try it will update the item and instead of .toString() use Convert.toString(object);. Even null value would be handled.

  • Can you explain why removing base.ItemAdded(properties); resolves this issue? – Submits Mar 5 '15 at 9:35
  • 1
    base.ItemAdded(properties); is to override the base class SPItemEventReceiver method so you are passing the current property to that method after that you are trying to modify the item so the property remained same – Anandakrishnan Mar 5 '15 at 10:30

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.