November Happy Hour will be moved to Thursday December 5th.

Bug in DeletingPage

Vote:
 

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.

#85748
May 05, 2014 8:00
Vote:
 

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

#85756
May 05, 2014 9:33
Vote:
 

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);
         
                }
            }
        }

    

#85788
May 05, 2014 20:42
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.