Programmatic Recycle vs. Delete SF 7.1

Posted by Community Admin on 04-Aug-2018 21:41

Programmatic Recycle vs. Delete SF 7.1

All Replies

Posted by Community Admin on 22-Jul-2014 00:00

Today, I looked into how to recycle content items from the Module Builder instead of delete them.

It would have been nice to see this in the generated API documentation for my content types, but I found this other documentation which got me part of the way.

www.sitefinity.com/.../sending-items-to-the-recycle-bin

The technique is almost the same as the news version above:

dynamicModuleManager.RecycleBin.MoveToRecycleBin(master);

So instead of just getting the data item and moving it to the recycle bin, you need to get the data item, get its master and then move the master.

Since the documentation is still a bit sparse, I thought I'd post this.

DynamicContent resourceItem = dynamicModuleManager.GetDataItem(resourceType, resourceID);
var master = dynamicModuleManager.Lifecycle.Edit(resourceItem) as DynamicContent;
 
if (master != null)
    dynamicModuleManager.RecycleBin.MoveToRecycleBin(master);

Posted by Community Admin on 25-Jul-2014 00:00

Hi,

Thank you for sharing the code with the community. I will forward it to our documentation team.

Regards,
Stefani Tacheva
Telerik

 
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
 

This thread is closed