Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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.

share|improve this question

2 Answers 2

up vote 2 down vote accepted

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

share|improve this answer
    
Yes, thank you. This is the best way for me. –  andDaviD Jun 14 '12 at 14:24

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"

share|improve this answer
    
Thank's for answer, but I think, this decision better. –  andDaviD Jun 14 '12 at 8:45

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.