Getting scheduled task data

  Previous topic Next topic JavaScript is required for the print function Mail us feedback on this topic! Mail us feedback on this topic!  

The following sample code shows how you can get a scheduled task as a TaskInfo object:

 

[C#]

 

using CMS.Scheduler;

using CMS.CMSHelper;

 

...

 

        int taskID = 1;

        int siteID = CMSContext.CurrentSiteID;

        string taskName = "Content.Publish";

        string siteName = "CorporateSiteASPX";

 

        // Get object

        TaskInfo ti = TaskInfoProvider.GetTaskInfo(taskID);

 

        TaskInfo ti2 = TaskInfoProvider.GetTaskInfo(taskName, siteID);

 

        TaskInfo ti3 = TaskInfoProvider.GetTaskInfo(taskName,siteName);

 

The following sample code shows how you can get a DataSet containing all scheduled tasks in the system:

 

[C#]

 

using System.Data;

using CMS.Scheduler;

 

...

 

        // Get DataSet of all scheduled tasks

        DataSet ds = TaskInfoProvider.GetAllTasks();

 

Page url: http://devnet.kentico.com/docs/5_5r2/devguide/index.html?api_getting_scheduled_task_data.htm