How to run a Custom Sharepoint Timer Job on alternate day? -
i have perform action using custom timer job on alternate day? code create , start timer job(in feature receiver) below,but runs daily , i have run on alternate days?
how it?
private bool createjob(spsite site) { bool jobcreated = false; seek {
timerjob job = new timerjob(jobname, site.webapplication); job.title = jobname; spminuteschedule schedule = new spminuteschedule(); schedule.beginsecond = 0; schedule.endsecond = 59; schedule.interval = 15; job.schedule = schedule; job.update(); } grab (exception) { homecoming jobcreated; } homecoming jobcreated; }
i think code above run every 15 minute, have spminuteschedule, must utilize spdailyschedule. see msdn documentation
however when job run can current dayofweek , run code when want
switch (datetime.now.dayofweek) { case dayofweek.friday: break; case dayofweek.monday: break; case dayofweek.saturday: break; case dayofweek.sunday: break; case dayofweek.thursday: break; case dayofweek.tuesday: break; case dayofweek.wednesday: break; default: break; }
or can save within job property bag lastly run. @ this link can find illustration spweb same spjob.
sharepoint sharepoint-2010 sharepoint-2007 timer-jobs sharepoint-timer-job
No comments:
Post a Comment