Is there any problem with calling the static Execute method of the class directly from application start? Otherwise that might be an option
If it's possible to call Execute async to not slow down app start it could be an option.
The job takes quite a while to finish so I'd like the scheduler to run it. I'd also prefer if the entered interval uses the app start time for later executions.
Either start a new thread and do it asynch or use the built in scheduler then I guess. To use the built in scheduler you can use something similar to this code in application start up... (using EPiServer.DataAbstraction)
private void InitializeScheduledJob()
const string fullTypeName = "PROJECT.Web.Plugins.ScheduledJobs.CLASS_NAME_OF_JOB";
const string assemblyName = "PROJECT.Web";
const string methodName = "Execute";
var now = DateTime.Now;
var job = ScheduledJob.Load(methodName, fullTypeName, assemblyName);
job.NextExecution = now.AddMinutes(1);
job.IntervalLength = 1;
job.IntervalType = ScheduledIntervalType.Days;
Hope this helps
Looks like exactly what I need. Will try out later this week. Thanks!
I have a ScheduledPlugIn that I'd like to run the next minute (at the latest) after each time the application starts.
That post has all I need but isn't there a way to save a scheduled job item than to use a SqlCommand?