0

I have a Deleting Event Receiver, say, on list A. Also I have other Deleting Event Receiver on list B. There is a deleting method in both receivers, which deletes items of each other. So, when an item is being deleted in list A the event receiver on list B also rises to delete item in list A. Cyclic calling of event receivers appears.

How can I escape of this situation? I need delete items from list A and list B wherever Event Receiver is called.

2 Answers 2

2

You can set EventFiringEnabled to false before calling Delete and reset it to true afterwards. This will prevent Events from firing in the current task due to the Delete

0
1

Add a column called "IsDeleted", which each event receiver sets on the item before it deletes it.

Then add a check on each event receiver to make sure the field isn't marked "IsDeleted"

1
  • Thank's for answer, but I think, this decision better.
    – andDaviD
    Commented Jun 14, 2012 at 8:45

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.