Note: For visitors of your site, this entry is only displayed for users with the preselected language English/English (en)
Creating a timerjob via API is quite simple! It saves you creating a scheduled task as it was in SPS2003 required.
When using the SPDailySchedule you have to remember that it would not be enouth to just set the starttime. You have to set the endtime additionally. The effective execution will be calculated based on a randomized value between the start- and the endtime.
Check the reflector:
public override DateTime NextOccurrence(DateTime dt){ DateTime dtRound = new DateTime(0x7d4, 1, 1, this.m_lBeginHour, this.m_lBeginMin, this.m_lBeginSec); dt = base.RoundToHour(dt, dtRound); if (this.IsFixed) { return dt; } dtRound = new DateTime(0x7d4, 1, 1, this.m_lEndHour, this.m_lEndMin, this.m_lEndSec); DateTime dtEnd = base.RoundToHour(dt, dtRound); return base.RandomizeOccurrence(dt, dtEnd);}
Therefore set BeginHour, BeginMinute, BeginSecond, EndHour, EndMinute and EndSecond as required.It is the same for:SPMinuteSchedule SPHourlySchedule SPDailySchedule SPMonthlySchedule SPWeeklySchedule SPYearlySchedule
Powered by: newtelligence dasBlog 2.1.8102.813
© Copyright 2012, Benjamin
E-mail