Vulnerability in EPiServer.Forms
There is already a post for this question but it seems to be archived for new posts. Please refer to https://world.episerver.com/forum/developer-forum/-Episerver-75-CMS/Thread-Container/2017/8/content-expired-event/
Is there an event that runs when the content is expired or is expiring? I tested SavingContent but it does not get fired in this case. I am also not interested in scheduling/scheduled content since they run at the time when the page is marked with an expiration date, not at the time of the expiration date.
There is no such event
I see. Getting expired pages as descriped in this post is possible but running a job that controls this often (once every couple of minutes) does not feel right. https://world.episerver.com/forum/legacy-forums/Episerver-7-CMS/Thread-Container/2016/1/expired-page-event/
I wonder if there are any other approaches I can take for this problem. I need to run a specific function as soon as the page becomes expired.
There is an Episerver scheduled job called 'Archive Function' that periodically runs based on its settings to perform the in-built archiving of expired pages.
I think that for you to pick up expired pages, you would be able to fairly easily create a new job that does something similar, but instead of archiving it performs whatever action you need to do. Does that help?
What do you need the expired event for? There is no change to the content at that point, it just the time in StopPublish value is passed. If you have fairly small amount of content then it might be OK to iterate over time. However, if you have a few thousands or more, then that's less than optimal.
Marcus and Quan, thank you for your responses.
I saw somewhere on this forum that there is a stored procedure that selects archived pages. While in theory it is possible to run it as frequent as possible, it might not be the smartest option to act in such manner. I need to act within seconds after the page is archived if not immediately.
Quan, do you think iterating couple of hundred pages every minute would be optimal?
Not directly to the database. That wouldn't be good.
I'm pretty sure that this value will be available in the Find index... you could maybe use that?