Parent and Child Tasks

In Microsoft Project, tasks are often organized hierarchically to represent work breakdown structures (WBS).

  • A parent task groups and summarizes the work of its subtasks.
  • A child task is indented beneath another task and contributes to its parent’s duration, cost, and progress.

Aspose.Tasks for .NET lets developers easily access and manipulate parent–child relationships programmatically.

Working with Parent Tasks and Children

The Task class provides access to hierarchical relationships:

These properties allow developers to traverse the task hierarchy in both directions.

Parent and Child Tasks in Microsoft Project

To declare a task as a parent or a child task in Microsoft Project:

  1. In the Task Entry form, select a task and click it.
  2. Select Outdent to turn a task into a parent, or,
  3. Select Indent to turn a task into a child.

Getting Parent and Child Tasks

The following C# example demonstrates how to retrieve parent and child tasks from 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// Parse through all the collected tasks
10foreach (Task task in collector.Tasks)
11{
12    Console.WriteLine(task.Get(Tsk.Name));
13}

Key Notes

FAQ

Q: Can a task have multiple parents?

Q: Do parent tasks affect scheduling directly?

Q: Are parent–child relationships preserved in MPP and XML formats?

Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.