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 Inset menu, select Column.
  2. Add the Stop and Resume columns.

The Stop and Resume columns in Microsoft Project

work with Stopped or Resumed tasks in Microsoft Project

Getting Stop and Resume Dates

The stop and resume dates are not available if the task has never stopped. For date values equal to NA, Aspose.Tasks take 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’s the stop and resume dates for all the tasks in a project.

 1// For complete examples and data files, please go to https://github.com/aspose-tasks/Aspose.Tasks-for-Java
 2String dataDir = Utils.getDataDir(StopAndResumeTask.class);
 3
 4Project project = new Project(dataDir + "input.mpp");
 5
 6// Create a ChildTasksCollector instance
 7ChildTasksCollector collector = new ChildTasksCollector();
 8
 9// Collect all the tasks from RootTask using TaskUtils
10TaskUtils.apply(project.getRootTask(), collector, 0);
11
12// Stop and Resume
13for (Task tsk : collector.getTasks()) {
14    if (tsk.get(Tsk.STOP).toString() == "1/1/2000")
15        System.out.println("NA");
16    else
17        System.out.println(tsk.get(Tsk.STOP).toString());
18    if (tsk.get(Tsk.RESUME).toString() == "1/1/2000")
19        System.out.println("NA");
20    else
21        System.out.println(tsk.get(Tsk.RESUME).toString());
22}
Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.