Stop and Resume a Task

In Microsoft Project, a task may be stopped temporarily and later resumed. The Stop date marks when the task was interrupted, and the Resume date specifies when work continues. Aspose.Tasks for .NET enables developers to access and modify these values programmatically.

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:

Viewing Stop and Resume Dates in Microsoft Project

To display stop and resume dates in Microsoft Project:

  1. Open the Task Entry form.
  2. From the Insert menu, select Column.
  3. Add the Stop and Resume columns.

If a task has never been interrupted, its Stop and Resume values remain NA.

Example: Reading Stop and Resume Dates

The following example shows how to read and display stop and resume dates for all 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}

Key Notes

FAQ

Q: Can I set custom stop and resume dates manually?

Q: What happens if Stop is later than Resume?

Q: Are Stop and Resume the same as Task Start and Finish?

Q: Does this work for recurring tasks?

Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.