JAMS Developer Guide
Creating a Job with a Schedule

You can create Jobs within the JAMS Client or programmatically. This sample shows you how to create Jobs with a defined Schedule in C#. 

If a specific folder location is defined for the ParentFolderName, the folder must already exist. If no folder is specified, the Job is put into the root folder by default.

Creating a Job with a Schedule
Copy Code
// 
// Get a connection to our JAMS Server 
// You will probably have to change the node name "localhost" 
// to the name of your JAMS Server 
// 
var server = Server.GetServer("localhost"); 
// 
// Create a new Job 
// 
var fileBackupJob = new Job 
{ 
    JobName = "FileBackup", 
    ParentFolderName = @"\Samples", 
    MethodName = "PowerShell", 
    Description = "Does a backup of the daily business files to an archive directory.", 
    Source = @"#Copy-Item C:\Temp\FolderA\* C:\Temp\FolderB\" 
 }; 
// 
// Add a Schedule to the Job 
// 
var scheduleTrigger = new ScheduleTrigger("Monday, Wednesday, Friday", new TimeOfDay("1:30 PM")); 
scheduleTrigger.ExceptForDate = "Last day of month"; 
fileBackupJob.Elements.Add(scheduleTrigger); 
// Save the Job 
fileBackupJob.Update(server); 

 

 


Copyright © Fortra, LLC and its group of companies.
All trademarks and registered trademarks are the property of their respective owners.