Calling all developers! We invite you to provide your input on Feature Experimentation by completing this brief survey.
Calling all developers! We invite you to provide your input on Feature Experimentation by completing this brief survey.
You can obtain a ScheduledJob instance through the static overload, passing in your type and assembly. When you have an instance you should be able to modify its parameters, and save it.
Something like this should set a schedule of daily at midnight, (note this is untested):
var yourJobType = typeof(YourScheduledJob);
var assemblyName = Assembly.GetAssembly(yourJobType).GetName().Name;
var yourJob = ScheduledJob.Load("Execute", yourJobType.FullName, assemblyName);
yourJob.IsEnabled = true;
yourJob.IntervalType = ScheduledIntervalType.Days;
yourJob.NextExecution = DateTime.Today.AddDays(1);
yourJob.Save();
Hope this works for you.
I have a scheduled job for EPiServer, I can see it in Admin mode can run it, etc. I general everything is ok with the job itself. But I would like to provide default scheduling so that the user does not have to configure it manually. However, until I check the "Active" checkbox on job configuration page the job is not listed in ScheduledJob.List() collection. How to I make the job appear on this list programatically (from code)? I thought that maybe instantiating ScheduledJob class is the way to go, but the constructors require some weird parameters (date of last and next execution? isStatic?).