SharepointTimerJobScheduler Release 1

Rating: No reviews yet
Downloads: 1436
Released: Dec 16, 2008
Updated: May 6, 2009 by dworrad
Dev status: Beta Help Icon

Recommended Download

Application SharePointerTimerJobScheduler Release 1.1.0.0.zip
application, 22K, uploaded Jan 15, 2009 - 1436 downloads

Release Notes

SharepointTimerJobScheduler Release 1

To Install
  • Unzip the contents of Release 1.1.0.0.zip to a temporary location of the Sharepoint Sites Web server.
  • Double click the Install Feature.cmd and check that no error messges are displayed on the final stsadm command run.
  • Log onto the Sharepoint Site with Administrator priviliges.
  • Go to Site Settings
  • Under the Site Collection Administration headeing select Site collection features.
  • Find the Feature titled SharePointer Timer Job Scheduler and click on Activate.

Usage
Now you have the Feature installed you can start adding TimerJob Instances. These jobs don't need to inherit from the SPJobDefinition class. The Assemblies used must reside in the GAC to allow the SharepointTimerJobScheduler Timer Job access to them.
  • Go to the List TimerJobSchedule (In the Root Web).
  • Click on New.
  • Add a Title (this can be anything as it is more for Auditing purposes than anything else).
  • Select Activated from the Status dropdown.
  • If you want the job to run immediately then set the RunAtNextOpportunity checkbox to true. (This option can also be used for testing of a job or rerunning a failed job. The List is checked every 2 minutes for available instances to run). The RunAtNextOpportunity checkbox is set back to false on the successful activation of a job instance.
  • If you want your Job to run at a Specific time then select the DaysToRun and the HoursToRun. (These fields can be left empty which gives you the option of having jobs that can be run whenever the need by setting the RunAtNextOpportunity option to true). If the DaysToRun and the HoursToRun fields are set then the job will only be activated once in that hour. It keeps track of this through the LastRunDateTime field which is set after a job instance is succesfully activated.
  • The Assembly of the job you want must be strong named and be installed in the GAC. i.e The text you need to add here in the Assembly field will look something like this - MyTimerJobAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=8e20aa8796940e26
  • The Class field must contain the Namespace i.e It may look something like this MyTimerJobAssembly.TimerJobs.MyTimerJobClass.
  • The Method field is the method to invoke to start the Job i.e Execute (No need to add the brackets).
  • The LastRunDateTime field can be left empty as this is used to keep track of if the job has been run at the correct time.
  • The final 4 fields are ConstructorParameter1, ConstructorParameter2, ConstructorParameter3 and ConstructorParameter4. These fields can be used if you need to pass Parameters into a constructor. Once the TimerJobScheduler finds a empty parameter it assumes that the rest are empty which allows you to use a constructor with 0, 1, 2, 3 or 4 parameters. e.g If I wanted to connect to specific SPSite then I might use the Sites Url as one of the parameters so I can create the SPSite object. I might use the second parameter for the Url of the SPWeb so that I can then use the Site to create the SPWeb by using the OpenWeb method.

Example Timer Configuration
Title - MyTimerJobExample
Status - Enabled
RunAtNextOpportunity - Yes
DaysToRun - Monday
HoursToRun - 6am
Assembly - MyTimerJobAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=8e20aa8796940e26
Class - MyTimerJobAssembly.TimerJobs.MyTimerJobClass
Method - Execute
LastRunDateTime -
ConstructorParameter1 - http://MySharepointSite
ConstructorParameter2 - /
ConstructorParameter3 -
ConstructorParameter4 -

Code Example
using Microsoft.SharePoint;

namespace MyTimerJobAssembly.TimerJobs
{
public class MyTimerJobClass
{
SPSite Site;
SPWeb Web;

public MyTimerJobClass(string strURL, string webURL)
{
Site = new SPSite(strURL);
Web = Site.OpenWeb(webURL);
}
public void Execute()
{
Do Something
}
}}

Check Out my blog at - http://my-sharepointer.blogspot.com/

Reviews for this release

No reviews yet for this release.