When I delete a node, the AfterUnPublish event does fire, but the isTrashed property of the document is always false regardless of whether it is being deleted or not. So the question is, how do I run code when a node in the site is deleted?
Turns out that when you delete a node in the CMS, the Document.AfterUnPublish event fires, followed by the Document.BeforeMoveToTrash and Document.AfterMoveToTrash. That solved my problem (at last!).
DataType Delete Event handlers
public EventDataType() { DataTypeDefinition.BeforeDelete += new EventHandler<umbraco.cms.businesslogic.DeleteEventArgs>(DataTypeDefinition_BeforeDelete); DataTypeDefinition.AfterDelete += new EventHandler<DeleteEventArgs>(DataTypeDefinition_AfterDelete); DataTypeDefinition.BeforeSave += new EventHandler<SaveEventArgs>(DataTypeDefinition_BeforeSave); } void DataTypeDefinition_BeforeDelete(object sender, DeleteEventArgs e) { throw new NotImplementedException(); } void DataTypeDefinition_AfterDelete(object sender, DeleteEventArgs e) { throw new NotImplementedException(); } void DataTypeDefinition_BeforeSave(object sender, SaveEventArgs e) { throw new NotImplementedException(); }I'm having a similar problem with events not firing on delete.
I'm using the latest version: umbraco v 4.7.1.1 (Assembly version: 1.0.4393.24044)
None of these events are firing for me:
The following events are firing fine:
When I delete a node, the AfterUnPublish event does fire, but the isTrashed property of the document is always false regardless of whether it is being deleted or not. So the question is, how do I run code when a node in the site is deleted?
Thanks,
David
Hi all,
Turns out that when you delete a node in the CMS, the Document.AfterUnPublish event fires, followed by the Document.BeforeMoveToTrash and Document.AfterMoveToTrash. That solved my problem (at last!).
Cheers,
David
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.