Search Results for

    Show / Hide Table of Contents
    View Source

    Class ContentPublishedNotification

    Notification that is published after content has been published.

    Inheritance
    object
    StatefulNotification
    ObjectNotification<IEnumerable<IContent>>
    EnumerableObjectNotification<IContent>
    Namespace: Umbraco.Cms.Core.Notifications
    Assembly: Umbraco.Core.dll
    Syntax
    public sealed class ContentPublishedNotification : EnumerableObjectNotification<IContent>, IStatefulNotification, INotification
    Remarks

    This notification is published by the IContentService after content has been made publicly available. It is not cancelable since the publish operation has already completed.

    Constructors

    View Source

    ContentPublishedNotification(IEnumerable<IContent>, EventMessages)

    Initializes a new instance of the ContentPublishedNotification class with multiple content items.

    Declaration
    public ContentPublishedNotification(IEnumerable<IContent> target, EventMessages messages)
    Parameters
    Type Name Description
    IEnumerable<IContent> target

    The collection of content items that were published.

    EventMessages messages

    The event messages collection.

    View Source

    ContentPublishedNotification(IEnumerable<IContent>, EventMessages, bool)

    Initializes a new instance of the ContentPublishedNotification class with multiple content items and descendant flag.

    Declaration
    public ContentPublishedNotification(IEnumerable<IContent> target, EventMessages messages, bool includeDescendants)
    Parameters
    Type Name Description
    IEnumerable<IContent> target

    The collection of content items that were published.

    EventMessages messages

    The event messages collection.

    bool includeDescendants

    A value indicating whether descendants were included in the publish operation.

    View Source

    ContentPublishedNotification(IEnumerable<IContent>, EventMessages, bool, IReadOnlyDictionary<Guid, IReadOnlyCollection<string>>?, IReadOnlyDictionary<Guid, IReadOnlyCollection<string>>?)

    Initializes a new instance of the ContentPublishedNotification class with multiple content items, the descendant flag and the cultures that were published and unpublished per item.

    Declaration
    public ContentPublishedNotification(IEnumerable<IContent> target, EventMessages messages, bool includeDescendants, IReadOnlyDictionary<Guid, IReadOnlyCollection<string>>? publishedCultures, IReadOnlyDictionary<Guid, IReadOnlyCollection<string>>? unpublishedCultures)
    Parameters
    Type Name Description
    IEnumerable<IContent> target

    The collection of content items that were published.

    EventMessages messages

    The event messages collection.

    bool includeDescendants

    A value indicating whether descendants were included in the publish operation.

    IReadOnlyDictionary<Guid, IReadOnlyCollection<string>> publishedCultures

    The cultures that were published, keyed by content Key.

    IReadOnlyDictionary<Guid, IReadOnlyCollection<string>> unpublishedCultures

    The cultures that were unpublished as part of the publish operation, keyed by content Key.

    View Source

    ContentPublishedNotification(IContent, EventMessages)

    Initializes a new instance of the ContentPublishedNotification class with a single content item.

    Declaration
    public ContentPublishedNotification(IContent target, EventMessages messages)
    Parameters
    Type Name Description
    IContent target

    The content item that was published.

    EventMessages messages

    The event messages collection.

    View Source

    ContentPublishedNotification(IContent, EventMessages, IReadOnlyDictionary<Guid, IReadOnlyCollection<string>>?, IReadOnlyDictionary<Guid, IReadOnlyCollection<string>>?)

    Initializes a new instance of the ContentPublishedNotification class with a single content item and the cultures that were published and unpublished.

    Declaration
    public ContentPublishedNotification(IContent target, EventMessages messages, IReadOnlyDictionary<Guid, IReadOnlyCollection<string>>? publishedCultures, IReadOnlyDictionary<Guid, IReadOnlyCollection<string>>? unpublishedCultures)
    Parameters
    Type Name Description
    IContent target

    The content item that was published.

    EventMessages messages

    The event messages collection.

    IReadOnlyDictionary<Guid, IReadOnlyCollection<string>> publishedCultures

    The cultures that were published, keyed by content Key.

    IReadOnlyDictionary<Guid, IReadOnlyCollection<string>> unpublishedCultures

    The cultures that were unpublished as part of the publish operation, keyed by content Key.

    Properties

    View Source

    IncludeDescendants

    Gets a value indicating whether descendants were included in the publish operation.

    Declaration
    public bool IncludeDescendants { get; }
    Property Value
    Type Description
    bool
    View Source

    PublishedCultures

    Gets the cultures that were published for each content item, keyed by content Key.

    Declaration
    public IReadOnlyDictionary<Guid, IReadOnlyCollection<string>>? PublishedCultures { get; }
    Property Value
    Type Description
    IReadOnlyDictionary<Guid, IReadOnlyCollection<string>>
    Remarks

    This reports every culture explicitly published in the operation (not only those whose data changed) — contrast with SavedCultures, which is a changed-only delta. For a branch publish (IncludeDescendants is true) each published document has its own entry. Populated at raise-time (change tracking on the entity is reset once persisted, so it cannot be recovered from PublishedEntities afterwards). For invariant content the value is ["*"]. A document is absent when no per-culture delta was tracked for it — e.g. descendants re-published as a side effect of publishing an ancestor. The dictionary itself is null only when the notification was raised without culture information (for example via a constructor overload that does not accept it).

    View Source

    PublishedEntities

    Gets the collection of IContent items that were published.

    Declaration
    public IEnumerable<IContent> PublishedEntities { get; }
    Property Value
    Type Description
    IEnumerable<IContent>
    View Source

    UnpublishedCultures

    Gets the cultures that were unpublished as part of this publish operation, keyed by content Key.

    Declaration
    public IReadOnlyDictionary<Guid, IReadOnlyCollection<string>>? UnpublishedCultures { get; }
    Property Value
    Type Description
    IReadOnlyDictionary<Guid, IReadOnlyCollection<string>>
    Remarks

    Unpublishing an individual culture of a variant document is performed as a publish operation (the document is re-published with that culture cleared), so the affected culture is reported here — not on a ContentUnpublishedNotification, which is only raised when the document as a whole is unpublished.

    Note that unpublishing several cultures at once is processed one culture at a time, so it raises one ContentPublishedNotification per culture — each carrying a single entry here — rather than one notification listing them all. Populated at raise-time; null when unpublishing a culture was not part of this operation at all (for invariant content, or a publish that took nothing down).

    • View Source
    In this article
    Back to top Copyright © 2016-present Umbraco
    Generated by DocFX