So what are our options.... Well currently your only real option is to code a Sharepoint Timer Job solution which inherits SPJobDefinition and then code a SPFeatureReceiver which installs a Timer Job and points it at your newly created SPJobDefinition code.
This is all well and good but the real fun and games start when you want to change when the Job runs or how often it runs... What if you change you mind several times? (Well it has been known to happen). This is where SPTimerJobs really fail to live up to expectation.
So I decided to code a easily installable solution where Jobs can be Scheduled from a Sharepoint List which sits in the RootWeb of the Sharepoint Site. Now we can change the Days and Hours the Job, runs not to mention we can also start the job automatically. We can aslo Disable the job easily too.
Download the Sharepoint TimerJobScheduler - http://www.codeplex.com/SPTimerScheduler
Just download the zip file and follow the release notes to install the Feature into the site. Then you are ready to add your own code as Job Instances to the list.
This solution is a SPTimerJob which looks at the TimerJobSchedule List in the RootWeb and runs any TimerJobInstances when the Current Day and Hour is equal to the DaysToRun and HoursToRun fields.
The underlying SPTimerJob runs every 2 minutes which means when you go into the Instance and check the RunAtNextOpportunity checkbox, your TimerJobInstance will run almost immediately.
Once you've set the Days and Hours to run you need to set the Assembly, Class, Method and ConstructorParameters. The Assembly needs to be strong named and placed in the GAC. The Assmebly name will need to be fully Qualified (e.g SharePointerTimerJobScheduler, Version=22.214.171.124, Culture=neutral, PublicKeyToken=8e20aa8796940e26).
The Class name will need to be the full path including the namespace (e.g SharePointer.Utilities.TestTimerSchedule).
The Method name doesn't need to include the brackets (e.g Execute).
If ConstructorParameter1 is null then the TimerJobScheduler assumes that this is a Class with a default constructor. (If ConstructorParameter2 is null then it assumes it is a Class with a constructor that has a single parameter.. And so on).
public class TestTimerSchedule
public TestTimerSchedule(string strURL, string webURL, string strListName)
Site = new SPSite(strURL);
Web = Site.OpenWeb(webURL);
ListName = strListName;
ListItemPrefix = "New Item";
public void Execute()
Web.AllowUnsafeUpdates = true;
SPListItem Item = Web.Lists[ListName].Items.Add();
Item["Title"] = ListItemPrefix + " added at - " + DateTime.Now.ToString();
private void CreateTestList()
Web.Lists.Add(ListName, "A list to test the execution of the TimerJobScheduler", SPListTemplateType.GenericList);
private bool ListAlreadyExist(SPListCollection sPListCollection)
foreach (SPList list in sPListCollection)
if (list.Title == ListName)
Hope it helps