For scheduling daily, use code like this:
SPDailySchedule dailySchedule = new SPDailySchedule();
dailySchedule.BeginHour = 0;
dailySchedule.BeginMinute = 0;
dailySchedule.BeginSecond = 0;
dailySchedule.EndHour = 23;
dailySchedule.EndMinute = 59;
dailySchedule.EndSecond = 59;
job.Schedule = dailySchedule;
That tells SharePoint to run the job any time between 00:00:00 (12:00
AM) and 23:59:59 (11:59 PM) each day. You can make this window shorter
if you need to schedule it during off-peak hours.
You can also run the job hourly using this code:
SPHourlySchedule hourlySchedule = new SPHourlySchedule();
hourlySchedule.BeginMinute = 0;
hourlySchedule.EndMinute = 59;
job.Schedule = hourlySchedule;
Or every X number of minutes using this code:
SPMinuteSchedule minuteSchedule = new SPMinuteSchedule();
minuteSchedule.BeginSecond = 0;
minuteSchedule.EndSecond = 59;
minuteSchedule.Interval = X;
job.Schedule = minuteSchedule;
The Interval is only available on the SPMinuteSchedule class. Setting
it to 15 will run the job every 15 minutes for example.
HI nice post of time jobs ,i have any query abt sharpoint i will send u comment or send me id
ReplyDelete