I have a schedule section set up on my site, which uses 'schedule instance' nodes to store event dates for the schedule. I want these nodes to auto-delete once the event passes, as determined by the value of a date picker property on the node. What's the simplest way to do this?
Preferably, I'd like the deletion to happen automatically, regardless of whether anyone is interacting with the website at the time. For the purposes of the project, it's important that it doesn't rely on any Umbraco packages, but .NET libraries are acceptable. Any suggestions are appreciated.
I know about the un-publishing capability, but I want the nodes to be deleted completely. Otherwise, the list of nodes is going to get too big over time, and someone would need to manually delete them.
I know how I could cull the list of nodes on an event like page save, but I want it to happen automatically on a time interval instead.
Hi Yakov,
This is pretty nice - would it be possible to use this for only a specific document type?
The reason I ask is, what if someone puts an unpublish date on say a News article and another on an Announcement. They want the Announcement deleted but not the News.
Using Umbraco's built-in scheduler looks like it will work well enough for me, so I'm going to make an Umbraco WebAPI controller to delete the nodes, and stick that URL in the scheduler config.
Simplest way to auto-delete nodes on date?
I have a schedule section set up on my site, which uses 'schedule instance' nodes to store event dates for the schedule. I want these nodes to auto-delete once the event passes, as determined by the value of a date picker property on the node. What's the simplest way to do this?
Preferably, I'd like the deletion to happen automatically, regardless of whether anyone is interacting with the website at the time. For the purposes of the project, it's important that it doesn't rely on any Umbraco packages, but .NET libraries are acceptable. Any suggestions are appreciated.
Thanks,
David
You can schedule page to be unpublished at specific date and time. Umbraco supports it out of the box.
Hi Yakov,
I know about the un-publishing capability, but I want the nodes to be deleted completely. Otherwise, the list of nodes is going to get too big over time, and someone would need to manually delete them.
I know how I could cull the list of nodes on an event like page save, but I want it to happen automatically on a time interval instead.
Thanks,
David
Another option is to subscribe to the unpublished event and delete node completely
in application handler
That's a pretty good idea, thanks.
Hi Yakov, This is pretty nice - would it be possible to use this for only a specific document type? The reason I ask is, what if someone puts an unpublish date on say a News article and another on an Announcement. They want the Announcement deleted but not the News.
O.
I think it's should work in this way
I also found this, which was helpful:
https://growcreate.co.uk/blog/better-task-scheduling-in-umbraco/
Using Umbraco's built-in scheduler looks like it will work well enough for me, so I'm going to make an Umbraco WebAPI controller to delete the nodes, and stick that URL in the scheduler config.
Yes, you can do it this way too, when you run over all nodes and search node to delete, it may be very expensive for big sites.
is working on a reply...