This project is read-only.

Event Scheduler

Sep 17, 2008 at 4:55 PM
This might have already been addressed, I just could not find it.
I want to be able to update a page but have the update go into effect at a future time, is this possible? I set the date in the advaced tab when editing but the change still happend when I saved the page.

I love everything I see with the framework, I have a client who wants to be able to post a daily schedule, she wants to edit the dates and times during the day and have it change at midnight.

Thanks for the help.

Sep 17, 2008 at 8:27 PM
I imagine you want to change some content and have it appear on the site at a future time. Like press releases on IR pages.

If it's a new page you can do this using the published between on the advanced tab.

Changing an existing page and delaying the changes is not available right now. I can imagine implementing this would involve:
  • Using "Save without publishing" on a page
  • Creating a ScheduledAction
  • Have the scheduled action find the page above (one way would be defining a checkbox on the page that we search for)
  • Publish the page at the appropriate moment
Let me know if you want to go down this path and I'll be happy to provide more information.
Jul 7, 2009 at 8:11 PM


Has this feature been added yet? If not, could you provide some more details as I have a requirement to implement this functionality.



Jul 8, 2009 at 8:17 PM

Hi, are you referring to delayed publishing of versions?

Jul 8, 2009 at 8:50 PM


Yes, the ability to publish and expire pages / versions at a future date / time.

Many thanks,


Jul 20, 2009 at 6:16 PM


did you have a vision of how future publishing should work? I have some time to work on this feature (as we need to implement it) and it looks like you've made a start with the versioning aspects of N2 - but before we go and invent an entirely different way of doing future publishing, I would love to get your thoughts / ideas / approach on implementing this feature.



Jul 20, 2009 at 11:00 PM

Okay, here goes.

An additional option in the publish button/dropdown "Publish later".

Clicking on it displays a date picker.

Choosing a date creates a version with a certain detail set on it

version["DelayPublishingUntil"] = theDate;
//save it

A scheduled job periodically looks for items where the date has arrived and publishes them:

var items = N2.Find.Items.Where.Detail("DelayPublishingUntil").Lt(DateTime.Now).IncludeVersions(true).Select();
for(... in items)
     N2.Context.Current.Resolve<IVersioningManager>().ReplaceVersion(item.VersionOf, item);
// remove the detail from the item... }

Maybe some kind of notification when editing that there is a version waiting to be published.

Aug 2, 2009 at 7:18 PM

Hi ya,

Okay I gave this a go and I’m afraid I’m a bit stuck.  The versioning is a bit tricky and I was hoping you could give me some advice. 

I’ll start with what I’ve done thus far and where I’m at.

I’ve added another button called “Save and publish in future” which at the moment mimics the OnSaveUnpublishedCommand method.  (This should give me that new version in the db) The only thing I do extra is the following:   ie.CurrentItem["DelayPublishingUntil"] = DateTime.Now; (Will get this from a date picker eventually)

I have a new class called PublishScheduledAction.cs and in the override void Execute() method I pretty much did exactly what you said above.  However I’m not sure how to get the correct version when I do N2.Context.Current.Resolve<IVersioningManager>().ReplaceVersion(item.VersionOf, item);

item.VersionOf is null, and as far as I understand I should instead be passing the “new or saved” version.  I hope this make sense.  How do I get the correct version so that I can effectively ReplaceVersion?


Thanks, much appreciated.


Aug 5, 2009 at 11:55 AM

Let me explain a bit how this is implemented.

The first time an item is saved it's created and inserted in the tree hierarchy. At this point it can either be published or not depending on the Published and Expires properties. If Published is in the future the item will become "published" when this date has been reached.

The versioning works by making a copy of the item, removing it from the tree hierarchy and saving it with a reference to the master version (as indicated by VersionOf). When a version needs to be restored the master version's details are replaced by version's

I think you need to handle two distinct scenarios:

  • The first time an item is saved it becomes the master version, regardless of it beeing published or not. When the published date is reached the item is displayed.
  • When saving a revision for beeing published at a later time you need to find it. A good way to do this is using the finder:

Did that make any sense?

Aug 6, 2009 at 9:46 AM

Hi Libardo,

this makes sense, thanks.  Once I get the other little bits working I'll submit the code for review.


Aug 18, 2009 at 9:16 AM


StanleyIpkiss has submitted a patch with this feature:




Aug 19, 2009 at 8:39 PM

Thanks for the hint. I'll check it out.