Actual Properties

The actual properties are used to find out how much time or money has been sent on a task to date.

Working with Actual Properties

The static class Tsk exposes a number of properties for determining a task’s actual properties:

The ChildTasksCollector class collects all the child tasks from a given RootTask when used by TaskUtils.

Actual Properties in Microsoft Project

To access these properties in Microsoft Project:

  1. On the View menu, select More Views and then Task Entry.
  2. On the Insert menu, select Column and add the desired columns to the Task Entry form.

Getting Actual Properties with Aspose.Tasks

A tasks’ actual properties can be obtained by traversing the tasks in a project. The code samples below write the actual properties for all tasks found in a project to a console window.

 1// Create Project instance
 2Project project = new Project("New Project.mpp");
 3
 4// Create a ChildTasksCollector instance
 5ChildTasksCollector collector = new ChildTasksCollector();
 6
 7// Collect all the tasks from RootTask using TaskUtils
 8TaskUtils.Apply(project.RootTask, collector, 0);
 9
10// Parse through all the collected tasks
11foreach (Task task in collector.Tasks)
12{
13    Console.WriteLine("Task Name : " + task.Get(Tsk.Name));
14    Console.WriteLine("Actual Start: " + task.Get(Tsk.ActualStart).ToLongDateString());
15    Console.WriteLine("Actual Finish: " + task.Get(Tsk.ActualFinish).ToLongDateString());
16    Console.WriteLine("Actual Duration: " + task.Get(Tsk.ActualDuration).TimeSpan.Hours.ToString());
17    Console.WriteLine("Actual Cost: " + task.Get(Tsk.ActualCost).ToString());
18    Console.WriteLine("---------------------------------------------");
19}
Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.