Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at

  • ianhoughton 236 posts 484 karma points c-trib
    Oct 01, 2014 @ 21:56

    Getting Media info from recycle bin before delete

    Umbraco 4.11.10

    I'm trying to run some code on the Media.AfterDelete event but I can't access the media properties as their all null when in the recycle bin (I presume as it has the IsTrashed flag set to true)

    I've tried creating a new Media item from the ID being passed in from the recycle bin, but this doesn't work either.

    I could use the Media.AfterMoveToTrash, but this would mean the code would run when its moved in the Recycle bin, but the user could then restore the item back into the media section (which is not what i want)

    Any ideas ?

  • ianhoughton 236 posts 484 karma points c-trib
    Oct 02, 2014 @ 10:01

    Moved my code into the Media.BeforeDelete event and this is now working fine.

  • Charles Afford 1163 posts 1709 karma points
    Oct 02, 2014 @ 10:02
    Charles Afford

    I dont think you will be able to do this throught the API for the resons described above.  Either you would have to write some SQL or a custom stored proc to retirve the data.  Prehaps you could store the media data in a custom table with a lookup so when the media is deleted you can call a sql script that can look up the media data in your custom table?

    Let me know what you come up with :)


Please Sign in or register to post replies

Write your reply to: