Copied to clipboard

Flag this post as spam?

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


  • Martin Lingstuyl 202 posts 379 karma points
    Dec 06, 2010 @ 16:13
    Martin Lingstuyl
    0

    Deleting Recycle Bin items from C#

    Hi,

     

    does anyone now if it's possible (and especially how) to delete items from the recycle bin programmatically?

    Or maybe recursively delete them in the first place, so they don't enter the recycle bin at all.

     

    Deletion is done from a backoffice plugin i'm creating.

     

    Hope to hear from someone.

     

    martin

     

  • Thomas Stock 40 posts 70 karma points
    Dec 06, 2010 @ 16:23
    Thomas Stock
    2
    Document doc = new Document(123);
    doc.delete(true);

    Document.delete() has an optional bool parameter "delete permanently". Set it to true and the document will not be sent to the recycle bin.

     

  • Stefan Kip 1606 posts 4098 karma points c-trib
    Dec 06, 2010 @ 16:55
    Stefan Kip
    0

    What Thomas says is true, as long as you're using umbraco 4.5(+)...

    With umbraco 4.0.x you should call doc.delete(); twice, first time moves it to the recycle bin, second time deletes the document.

  • Martin Lingstuyl 202 posts 379 karma points
    Dec 06, 2010 @ 18:37
    Martin Lingstuyl
    0

    Ah great, thanks.

    you guys rule.

  • 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.

Please Sign in or register to post replies