Handling Critical and Effort-Driven Tasks

Microsoft Project recognized a number of different types of tasks. Tasks with no duration, for example, are considered milestones by default. Critical tasks make up the critical path, one or a series of tasks that, ultimately, determines how long a project will take.

Working with Critical and Effort-Driven Tasks

The Tsk class exposes the IsCritical and IsEffortDriven properties to handle critical and effort driven tasks:

Critical and Effort-driven Tasks Microsoft Project

To check whether a task is critical or effort-driven in Microsoft Project one need to double-click a task in the Task Entry form:

is the task critical or effort-driven

Getting Critical and Effort-Driven Tasks

The following code examples show how to get information about whether a task is critical or effort-driven.

 1Project project = new Project("New Project.mpp");
 3// Create a ChildTasksCollector instance
 4ChildTasksCollector collector = new ChildTasksCollector();
 6// Collect all the tasks from RootTask using TaskUtils
 7TaskUtils.Apply(project.RootTask, collector, 0);
 9// Parse through all the collected tasks
10foreach (Task task in collector.Tasks)
12    string strED = task.Get(Tsk.IsEffortDriven) ? "EffortDriven" : "Non-EffortDriven";
13    string strCrit = task.Get(Tsk.IsCritical) ? "Critical" : "Non-Critical";
14    Console.WriteLine(task.Get(Tsk.Name) + " : " + strED);
15    Console.WriteLine(task.Get(Tsk.Name) + " : " + strCrit);
Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.