I developed a custom event receiver class that overrides the ItemAdded method

after the list item is added I want to make some checks and based on a certain condition I want to delete the added item.

I was able to delete the item but i want to display an error message so I used

properties.Cancel = true; 

properties.ErrorMessage = "Can't insert this item";

when I debugged I found no errors but the user is not directed to the error page.

is there any workaround for this ?


1 Answer 1


Since you are using ItemAdded in SharePoint 2007 that event is asynchronous and happening after the item is added. Asynchronous means that it will happen "behind the scenes", ie you cant redirect the user to an error page. Instead try to use the ItemAdding if you need to cancel the event and present an error message for the user.

  • Thanks I already know that I want to force a redirection is it possible ?
    – Mina Wissa
    Commented Jun 17, 2010 at 13:12
  • 1
    You can only force a redirection in the synchronous events. Commented Jun 17, 2010 at 14:58

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.