1

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 ?

thanks

5

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 Samy Jun 17 '10 at 13:12
  • 1
    You can only force a redirection in the synchronous events. – Wictor Wilen MCA MCM MVP Jun 17 '10 at 14:58

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.