Here is a small example when I run the Task Scheduler.
This method will trigger all the failed Newsletters user requests to the third-party service.
public class JobTrigger
public void NewsLetter(Item items, Sitecore.Tasks.CommandItem newsLetterSignupCmdItem, Sitecore.Tasks.ScheduleItem newsLetterSignupScheduleItem)
// Put your code here.
Create a Command Task under /sitecore/system/Tasks/Commands/
Insert command template from Templates /sitecore/templates/System/Tasks/Command
Give the Type field enter the assembly qualified type and in the Method field enter the name of the method to be called in your class
Type: Feature.Newsletter.Jobs.JobTrigger, Feature.Newsletter
Method: mention the method name which needs to be executed. Example: Newsletter
Create a _Task Schedule under /sitecore/system/Tasks/Schedules/Job
CREATE A SCHEDULE TO RUN THE JOB
Under the Command Field: Specify the path of command.
In the Schedule field: specify the time how often need the job to be run.
Schedule field will have several piped values.
Start Date: 20170208
End Date: 99990101
Days of the week: Calculate based on the days of the week no.
Sunday = 1
Monday = 2
Tuesday = 4
Wednesday = 8
Thursday = 16
Friday = 32
Saturday = 64.
Let's say I want to run the job every day. It’s going to be (Sunday + Monday + Tuesday + Wednesday + Thursday + Friday + Saturday)
The minimum interval the task is to be run in HH.MM.SS format
The task is setup now to run at specified interval.