Using Notifications

Get started with Notifications.

Umbraco uses Notifications (similar to the Observer pattern) to allow you to hook into the workflow process for the backoffice. For example, notifications allow you to execute some code every time a page is published.

Notifications

All notifications reside in the Umbraco.Cms.Core.Notifications namespace and are postfixed with Notification.

Available notifications typically exist in pairs, with "before" and "after" notifications. For example, the ContentService class has the concept of publishing and published notifications. So, there is both a ContentPublishingNotification and a ContentPublishedNotification notification.

The notification to use depends on what you want to achieve. If you want to be able to cancel the action, you would use the CancelOperation method on the "before" notification. See the sample in ContentService Notifications. If you want to execute some code after the publishing has succeeded, then you would use the "after" notification.

Registering Notifications

Check the Notification Handler article to learn more about notification handlers lifetime, async notification handler and how to register the notification handlers.

List of Notifications

Below you can find a list of most used object notifications.

You can find a list of all supported notifications in the API Documentationarrow-up-right.

Content, Media, and Member notifications

chevron-rightContentService Notificationshashtag
chevron-rightMediaServiceNotificationshashtag
chevron-rightMemberService Notificationshashtag

The MemberService implements IMemberService and provides access to operations involving IMember.

Below you can find a list of the most common MemberService object notifications.

Other notifications

chevron-rightContentTypeService Notificationshashtag

The ContentTypeService class implements IContentTypeService. It provides access to operations involving IContentType.

Below you can find a list of the most common ContentTypeService object notifications.

chevron-rightMediaTypeService Notifications - object listhashtag

The MediaTypeService class implements IMediaTypeService. It provides access to operations involving IMediaType.

Below you can find a list of the most common MediaTypeService object notifications.

chevron-rightMemberTypeService Notificationshashtag
chevron-rightDataTypeService Notificationshashtag

The DataTypeService class implements IDataTypeService. It provides access to operations involving IDataType.

Below you can find a list of the most common DataTypeService object notifications.

chevron-rightFileService Notificationshashtag
chevron-rightLocalizationService Notificationshashtag
chevron-rightCacheRefresher Notificationshashtag
chevron-rightRelationService Notificationshashtag
chevron-rightUmbracoApplicationLifetime Notificationshashtag

Represents an Umbraco application lifetime (starting, started, stopping, stopped) notification.

Below you can find a list of the most common UmbracoApplicationLifetime object notifications.

Tree notifications

Learn more about these under Tree Change Notificationsarrow-up-right in the CMS API documentation.

Creating and publishing your own custom notifications

Umbraco uses notifications to allow people to hook into different workflow processes. This notification pattern is extensible, allowing you to create and publish custom notifications, and other people to observe and hook into your custom processes. This approach can be useful when creating Umbraco packages. For more information on how you create and publish your own notifications, see the creating and publishing notifications article.

Samples

Below you can find some articles with some examples using Notifications.

Last updated

Was this helpful?