// Save the scheduled task TaskInfoProvider.SetTaskInfo(newTask); }
The following example gets and updates a scheduled task.
privatebool GetAndUpdateScheduledTask() {
// Get the scheduled task TaskInfo updateTask = TaskInfoProvider.GetTaskInfo("MyNewTask", CMSContext.CurrentSiteID);
if (updateTask != null) { // Update the properties updateTask.TaskDisplayName = updateTask.TaskDisplayName.ToLower(); // Save the changes TaskInfoProvider.SetTaskInfo(updateTask); returntrue; } returnfalse; }
The following example gets and bulk updates scheduled tasks.
privatebool GetAndBulkUpdateScheduledTasks() { // Get the data DataSet tasks = TaskInfoProvider.GetAllTasks(); if (!DataHelper.DataSourceIsEmpty(tasks)) { // Loop through the individual items foreach (DataRow taskDr in tasks.Tables[0].Rows) { // Create object from DataRow TaskInfo modifyTask = newTaskInfo(taskDr); // Update the properties modifyTask.TaskDisplayName = modifyTask.TaskDisplayName.ToUpper(); // Save the changes TaskInfoProvider.SetTaskInfo(modifyTask); } returntrue; } returnfalse; }
The following example deletes a scheduled task.
privatebool DeleteScheduledTask() {
// Get the scheduled task TaskInfo deleteTask = TaskInfoProvider.GetTaskInfo("MyNewTask",CMSContext.CurrentSiteID);