Calling all developers! We invite you to provide your input on Feature Experimentation by completing this brief survey.
Calling all developers! We invite you to provide your input on Feature Experimentation by completing this brief survey.
Hi
If you use IContentEvents.DeletingContent you should get an event args if the type DeleteContentEventArgs. That has a DeletedDescendents property, which should have the information you are looking for.
If you want to use the old page specific events, I think the same information can be found in eventArgs.Items["DeletedDescendents"].
Regards
Per Gunsarfs
You might as well use strongly typed e.DeletedDescendents. This code works for me:
protected void InstanceDeletingContent(object sender, DeleteContentEventArgs e)
{
if (e.DeletedDescendents != null && e.DeletedDescendents.Any())
{
foreach (var deleted in e.DeletedDescendents)
{
var deletedContent = ServiceLocator.Current.GetInstance<IContentLoader>().Get<IContent>(deleted);
}
}
}
When emptying Trash, this event occurs only once (not once per item, but once in total).
The event does not include the page being deleted, so it is not possible to do necessary cleanup-tasks when pages are deleted.