Sitecore event handlers

One very useful area of Sitecore is the ability to subscribe to system events. Examples are things like when items are saved (item:saved), items are published etc.

All the out the box events can be seen within the <events> section of the config.

You can subscribe to events via config:

and raise your own custom events via:

One thing to note, events such as item:saved will be run when sometimes you don’t expect it. Examples are package installations.

You can guard against custom event handlers running during package installations if you check for the existence of the current httpContext:

For more info on how to make use of Sitecore events, have a look at http://sdn.sitecore.net/Articles/API/Using%20Events.aspx

One thought on “Sitecore event handlers

Leave a Reply

Your email address will not be published. Required fields are marked *