SharePoint 2016 Timer Job Schedule Options Visual Studio 2015

Here we will discuss what are the various options to schedule a timer job in SharePoint 2016 or SharePoint 2013 while developing using Visual Studio 2015. If you are new to timer job then you can see this article on how to develop a timer job using visual studio 2015 for SharePoint 2016 and also you can check how we can debug a timer job in visual studio 2015.

Below are the ways you can schedule a timer job:

Yearly:

SPYearlySchedule yearschedule = new SPYearlySchedule();

yearschedule.BeginMonth = 1;

yearschedule.EndMonth = 1;

yearschedule.BeginDay = 1;

yearschedule.EndDay = 1;

yearschedule.BeginHour = 1;

yearschedule.EndHour = 1;

yearschedule.BeginMinute = 5;

yearschedule.EndMinute = 5;

yearschedule.BeginSecond = 0;

yearschedule.EndSecond = 5;

Monthly:

SPMonthlySchedule monthschedule = new SPMonthlySchedule();

monthschedule.BeginDay = 1;

monthschedule.EndDay = 1;

monthschedule.BeginHour = 1;

monthschedule.EndHour = 1;

monthschedule.BeginMinute = 15;

monthschedule.EndMinute = 30;

Weekly:

SPWeeklySchedule schedule = new SPWeeklySchedule();

schedule.BeginDayOfWeek = DayOfWeek.Monday;

schedule.BeginHour = 2;

schedule.BeginMinute = 1;

schedule.BeginSecond = 0;

schedule.EndSecond = 5;

schedule.EndMinute = 1;

schedule.EndHour = 2;

                schedule.EndDayOfWeek = DayOfWeek.Monday;

Daily:

SPDailySchedule daySchedule = new SPDailySchedule();

daySchedule.BeginHour = 9;

daySchedule.BeginMinute = 0;

daySchedule.BeginSecond = 0;

daySchedule.EndSecond = 0;

daySchedule.EndMinute = 0;

daySchedule.EndHour = 9;

Hourly:

SPHourlySchedule hourSchedule = new SPHourlySchedule();

hourSchedule.BeginMinute = 10;


hourSchedule.EndMinute = 20;

Hope this will be helpful.


You May Also like the Following SharePoint Online Tutorials:

About Bijay Kumar

I am Bijay from Odisha, India. Currently working in my own venture TSInfo Technologies in Bangalore, India. I am Microsoft Office Servers and Services (SharePoint) MVP (5 times). I works in SharePoint 2016/2013/2010, SharePoint Online Office 365 etc. Check out My MVP Profile.. I also run popular SharePoint web site SharePointSky.com

View all posts by Bijay Kumar →