I wrote my timer job as follows:
public class YourJob : SPJobDefinition { private static string JOB_NAME = "YourJobName"; public override string Description { get { return "YourDescription"; } } public YourJob() : base() { } public YourJob(SPWebApplication webApp) : base(JOB_NAME, webApp, null, SPJobLockType.None) { this.Title = JOB_NAME; this.Schedule = GetSchedule(); }
After that you need to add your work to the event event receiver
[Guid("46b3a9b4-793e-4ab9-99ba-b003a3601e3a")] public class MainEventReceiver : SPFeatureReceiver { public static string JOB_NAME = "YourJobName"; public override void FeatureActivated(SPFeatureReceiverProperties properties) { SPSite site = properties.Feature.Parent as SPSite;
At the end, you can see your work in the Administration Center → Monitoring → Timer Jobs - View job definitions. There you can reset to define your schedule.
source share