Help us improve the documentation area
We'd love to make the documentation for Umbraco even better, but we need your help on where we should focus the most. So please help us help you by spending a few minutes taking this short survey.Take the Survey (and this box will also go away)
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 allows you to execute code during application 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 eventargs 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
- See ContentService Events for a listing of the ContentService object events.
- See MediaService Events for a listing of the MediaService object events.
- See ContentTypeService Events for a listing of the ContentTypeService object events.
- See DataTypeService Events for a listing of the DataTypeService object events.
- See FileService Events for a listing of the FileService object events.
- See LocalizationService Events for a listing of the LocalizationService object events.
- See Tree Events for a listing of the tree events.