It works the way that when you click the “publish with descendants” button Umbraco triggers a publish for each of the descendants that have been unpublished, but is now being published.
If you want to make sure to capture every time Umbraco does something with descendants, you should hook into the cache refreshed event and check if the “ChangeType” is equal to “TreeChangeType.RefreshBranch”.
This change type is used when a parent is being:
published from unpublished state
unpublished
And I am pretty sure that it also triggers when you click the publish with descendants button.
Capture event when publishing Page with all its child pages
In Umbraco when I publish a single page I can hook into the Event by using something like this:
BUT - what I would like to do is to hook into the event when I publish a page with all its child pages. Is there a way to do this in Umbraco 8?
Thanks
Jon
Hi Jon.
It works the way that when you click the “publish with descendants” button Umbraco triggers a publish for each of the descendants that have been unpublished, but is now being published.
If you want to make sure to capture every time Umbraco does something with descendants, you should hook into the cache refreshed event and check if the “ChangeType” is equal to “TreeChangeType.RefreshBranch”.
This change type is used when a parent is being:
And I am pretty sure that it also triggers when you click the publish with descendants button.
You can take a look at what I have done here: https://github.com/enterspeedhq/enterspeed-source-umbraco-cms/blob/8b4cb323e35b2159fdea100754862e4dd528cb3f/src/Enterspeed.Source.UmbracoCms.V8/Components/EnterspeedContentEventsComponent.cs#L238
In short: when Umbraco does something to the “branch”, aka to everything below the current node, we fetch the descendants and handles them as well.
Hope this helps.
Regards
Thank you so much - this is exactly what I was looking for :)
Perfect! Happy to help. :-)
is working on a reply...