Working with Tasks in .NET

Managing task actual properties is an essential part of project scheduling and reporting. In Aspose.Tasks for .NET, you can easily read a task’s actual cost, duration, start/finish dates, overtime work, and more. This allows developers to analyze project progress programmatically, without relying on Microsoft Project.

What Are Actual Properties?

Actual properties help you find out how much work, time, or money has already been spent on a task. These values are especially useful for comparing planned vs. actual progress.

Common Actual Properties

The static class Tsk exposes the following fields:

Viewing Actual Properties in Microsoft Project

If you want to compare values inside MS Project:

  1. Open the View menu → select More Views → choose Task Entry.
  2. On the Insert menu → select Column → add fields like Actual Start, Actual Finish, Actual Work, etc.

This way, you can visually verify the same data that Aspose.Tasks API provides programmatically.

Reading Actual Properties in C#

Below is a sample that loads a project file (.mpp) and prints actual task properties to the console.

 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}

Tip: You can use ChildTasksCollector with TaskUtils to recursively fetch all tasks from the root task.

Key Benefits

FAQ

Q: Do I need Microsoft Project installed to read Actual Properties?

Q: Can I update Actual Properties programmatically?

Q: Does this work with Primavera or only MS Project?

Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.