Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • jacob-sbn 3 posts 82 karma points
    May 15, 2023 @ 01:21
    jacob-sbn
    0

    How can I get publishing cultures from 'INotificationHandler<ContentPublishingNotification>'

    I success to get the published cultures from "INotificationHandler <ContentPublishedNotification>". But how can I take it from "INotificationHandler<ContentPublishingNotification>"?

    Thanks a lot

    var unpublishingCultures = publishedItem.AvailableCultures.Where(culture => notification.HasUnpublishedCulture(publishedItem, culture)).ToList();
    var publishingCultures = publishedItem.AvailableCultures.Where(culture => notification.HasPublishedCulture(publishedItem, culture)).ToList();
    
    • The code about get the published cultures from INotificationHandler ContentPublishedNotification.
  • Ramya Devendiran 28 posts 149 karma points
    Sep 20, 2023 @ 13:25
    Ramya Devendiran
    0

    Hi Jacob, did you figured it out. I am looking for a solution on how to get the list of cultures selected while saveandpublish content in a publishedNotification.

  • Marc Goodson 2155 posts 14408 karma points MVP 9x c-trib
    Sep 20, 2023 @ 14:19
    Marc Goodson
    0

    Hi Ramya

    There are Extension Helpers for ContentPublishingNotification and for ContentPublishedNotification, you can discover them here in the source:

    https://github.com/umbraco/Umbraco-CMS/blob/86697ff137ab6a35d5279f4c1d6991093e1bb54c/src/Umbraco.Core/Notifications/ContentNotificationExtensions.cs#L25C18-L28C43

    So Looks like there is a helper for

    IsPublishingCulture (when publishing) and HasPublishedCulture (when published)

    So you can use these in either notification to check which of the Available Culture Is 'Publishing' or Has 'Published'.

    regards

    Marc

Please Sign in or register to post replies

Write your reply to:

Draft