Stop and Resume a Task

A tasks’ stop date is the date that it should (or did) end. Sometimes, a task has to be stopped temporarily and then resumed later. Microsoft Project can calculate stop dates, or let users enter them manually.

Working with Stopped and Resumed Tasks

The Stop and Resume properties exposed by the Tsk class are used to read or write a task’s stop and resume date:

Microsoft Project view of Stop and Resume Dates

To see a task’s stop and resume dates:

  1. In the Task Entry form, on the Insert menu, select Column.
  2. Add the Stop and Resume columns.

Getting Stop and Resume Dates

The stop and resume dates are NA if the task has never stopped. For date values equal to NA, Aspose.Tasks takes the value “1/1/2000” if you’re using the evaluation version. When fully licensed, Aspose.Tasks uses DateTime.MinValue for NA values. The following examples display the stop and resume dates for all the tasks in a project.

 1Project project = new Project("New Project.mpp");
 2
 3// Create a ChildTasksCollector instance
 4ChildTasksCollector collector = new ChildTasksCollector();
 5
 6// Collect all the tasks from RootTask using TaskUtils
 7TaskUtils.Apply(project.RootTask, collector, 0);
 8
 9// Check Stop and Resume dates for all tasks
10foreach (Task task in collector.Tasks)
11{
12    if (task.Get(Tsk.Stop).ToShortDateString() == "1/1/2000")
13        Console.WriteLine("Stop: NA");
14    else
15        Console.WriteLine("Stop: " + task.Get(Tsk.Stop).ToShortDateString());
16
17    if (task.Get(Tsk.Resume).ToShortDateString() == "1/1/2000")
18        Console.WriteLine("Resume: NA");
19    else
20        Console.WriteLine("Resume: " + task.Get(Tsk.Resume).ToShortDateString());
21}
Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.