Hello,
I think all of us tried this at some point looking at out of the box features and surprise surprise you cannot do it 🙂
So here is my approach and it is a very simple one which can be extended in a much more complex piece of code but for my requirements it will do.
I have created a cs file with the code: AutomatedPublish (not sure if its a English word)
public class AutomatedPublish
{
public void FuturePublish(Item[] items, Sitecore.Tasks.CommandItem command, Sitecore.Tasks.ScheduleItem schedule)
{
foreach (var item in items)
{
// The publishOptions determine the source and target database,
// the publish mode and language, and the publish date
Sitecore.Publishing.PublishOptions publishOptions = new Sitecore.Publishing.PublishOptions(
item.Database,
Database.GetDatabase("web"),
Sitecore.Publishing.PublishMode.SingleItem,
item.Languag,System.DateTime.Now);
// Create a publisher with the publishoptions
Sitecore.Publishing.Publisher publisher = new Sitecore.Publishing.Publisher(publishOptions);
// Choose where to publish from
publisher.Options.RootItem = item;
// Publish children as well?
publisher.Options.Deep = false;
// Do the publish!
publisher.Publish();
}
}
}
In sitecore you will have to create the command in the System -> Tasks -> Commands.