How to cancel Event from executing?

If we want to cancel event, we can do it only using synchronous event receivers like Item Adding, Item Deleting.

Initially in SharePoint 2010, we could cancel event using properties.cancel = true; in event receiver. But in SharePoint 2013, it is obsolete. 

In SharePoint 2013, we can write any of the below statements in Synchronous event receiver code of the event, to cancel the in-progress event.

properties.Status = SPEventReceiverStatus.CancelNoError

properties.Status = SPEventReceiverStatus.CancelWithError

properties.Status = SPEventReceiverStatus.CancelWithRedirectUrl

We value your feedback:

Page URL:

Name:

 

Email:

 
 

Feedback:

 

© 2019 Code SharePoint