I'm not sure why it's not working, but may have heard this before. But from looking at the source code, think the event handler is only fired when document is being deleted permanently (ie deleted from recycle bin), which makes sense as the user may undelete it from the recycle bin.
So, depends what you want to do when a document gets deleted. You can subscribe to events to get notified when a document is being moved to the recycle bin...
hi ...
does anyone have any idea why all events of the object "Document" are file correctly except of the
Document
.AfterDelete
Document
.AfterDelete += new Document.DeleteEventHandler(Document_AfterDelete);
void
Document_AfterDelete(Document sender, DeleteEventArgs e)
{RemovePage(sender);}
and nothing fired
Hi gilpt,
Where are you putting this code? Best bet is to put it in a class that inherits from "umbraco.BusinessLogic.ApplicationBase".
Cheers, Lee.
PS. Remember to make your post titles more descriptive - as "hi ..." might get ignored by other forum members.
I'm not sure why it's not working, but may have heard this before. But from looking at the source code, think the event handler is only fired when document is being deleted permanently (ie deleted from recycle bin), which makes sense as the user may undelete it from the recycle bin.
So, depends what you want to do when a document gets deleted. You can subscribe to events to get notified when a document is being moved to the recycle bin...
Hope this helps.
Regards,
/Dirk
Think Dirk nailed it here! :-)
Try using the "AfterMoveToTrash" event - see if that works?
Cheers, Lee.
thanks all , i needed the "AfterMoveToTrash" event
is working on a reply...