5

When adding a new document, both Add and Update events trigger my event receivers. I have an Add and an Update event receiver.

Is there a way to avoid the Update event?

2 Answers 2

4

You can't actually stop the Updated event from firing. There's a full lifecycle of events that will always run, so the trick is to check for certain conditions within a given event to determine whether or not you want your code to run at that time. This blog does a good job of walking through the events, and why they fire. Ultimately you can look at a combination of before and after properties to determine whether your code should run, similar to an example on the above blog that looks for certain metadata to determine whether the event is tied to a user just checking a document in.

Cheers, Matt

1

On Item added, before item.update() disable event firing, this.EventFiringEnabled =true; will do

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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