We have moved!

You are currently looking at documentation for Umbraco 8 and older versions.
Go to docs.umbraco.com for documentation for Umbraco 9 and newer versions.

    Using Events

    Umbraco uses .Net events to allow you to hook into the workflow processes for the backoffice. For example you might want to execute some code every time a page is published. Events allow you to do that.


    Umbraco uses Compositions and Components to allow you to execute code during startup. This is also the correct place to register for many other types of events including the ability to bind to HttpApplication events.


    Typically, the events available exist in pairs, with a "before" and "after" event. For example the ContentService class has the concept of publishing, and fires events when this occurs. In that case there is both a ContentService.Publishing and ContentService.Published event.

    Which one you want to use depends on what you want to achieve. If you want to be able to cancel the action, then you would use the "before" event, and use the event arguments to cancel it. See the sample handler further down. If you want to execute some code after the publishing has succeeded, then you would use the "after" event.

    Content and Media events

    Other events

    Tree events

    Editor Model events

    See EditorModelEventManager Events for a listing of the EditorModel events

    Useful for manipulating the model before it is sent to an editor in the backoffice - eg. perhaps to set a default value of a property on a new document.