I want to create a custom timer job with a SPYearlySchedule
. The job deploys successfully, but when I view its settings in the central admin, it is shown to have an hourly schedule:
Furthermore, as you can see, there seems to be no way to manually configure the job as a yearly job - SharePoint only lists radio boxes ranging from "Minutes" to "Monthly" and that's it.
What could be the cause of this? Here's how I'm creating the schedule:
private void CreateJob(SPWebApplication webApp)
{
MyTimerJob job = new MyTimerJob(MyTimerJob.TimerJobName, webApp);
SPYearlySchedule schedule = new SPYearlySchedule();
schedule.BeginMonth = 10;
schedule.BeginDay = 10;
schedule.BeginHour = 1;
schedule.BeginMinute = 0;
schedule.BeginSecond = 0;
schedule.EndMonth = 10;
schedule.EndDay = 15;
schedule.EndHour = 3;
schedule.EndMinute = 0;
schedule.EndSecond = 0;
job.Schedule = schedule;
job.Update();
}
I can create other schedules (e.g. weekly or daily) without any problems.