Read Timephased Data of a Resource
Timephased data in Microsoft Project represents the distribution of resource work and costs across a project timeline. This allows project managers to analyze workload allocation, resource utilization, and cost flow over specific time intervals. With Aspose.Tasks for .NET, developers can programmatically read resource timephased data directly from Microsoft Project files (MPP/XML). This makes it possible to create detailed reports, perform cost forecasting, and integrate resource analytics into custom project management systems.
Reading Timephased Resource Data
The
Resource class provides the TimeScaleData
method to extract timephased information.
- To get work-based timephased data, the method requires the project’s start date and finish date as parameters.
- To get cost-based timephased data, an additional parameter specifying the timephased data type (e.g.,
ResourceCost
) must be provided.
This flexibility allows developers to analyze both workload and financial distribution across a project schedule.
Code Example
The following example demonstrates how to read the timephased data of a resource. This snippet loads a project file, retrieves resource-level timephased data, and outputs values such as work or cost per defined timescale. It can be applied in dashboards, reporting systems, or forecasting tools.
1Project project = new Project("New Project.mpp");
2
3// Get the Resource by its ID
4Resource resource = project.Resources.GetByUid(1);
5
6// Print Timephased data of ResourceWork
7Console.WriteLine("Timephased data of ResourceWork");
8foreach (TimephasedData td in resource.GetTimephasedData(project.Get(Prj.StartDate), project.Get(Prj.FinishDate)))
9{
10 Console.Write("Start: " + td.Start.ToShortDateString());
11 Console.Write(" Work: " + td.Value + Environment.NewLine);
12}
13
14// Print Timephased data of ResourceCost
15Console.WriteLine("Timephased data of ResourceCost");
16foreach (TimephasedData td in resource.GetTimephasedData(project.Get(Prj.StartDate), project.Get(Prj.FinishDate), TimephasedDataType.ResourceCost))
17{
18 Console.Write("Start: " + td.Start.ToShortDateString());
19 Console.Write(" Cost: " + td.Value + Environment.NewLine);
20}
FAQ
Q: Do I need Microsoft Project installed to read timephased data?
- No. Aspose.Tasks for .NET works independently of Microsoft Project.
Q: What is timephased data in project management?
- Timephased data is the distribution of work, costs, or other values across specific time intervals, providing a timeline-based view of resource allocation.
Q: Which project file formats support timephased data extraction?
- Aspose.Tasks supports both MPP and XML formats across different Microsoft Project versions.
Q: Can I extract both work and cost data at the same time?
- Yes. You can call the
TimeScaleData
method separately for work and cost, then combine results into a consolidated report.
Q: Can I customize the time intervals (daily, weekly, monthly)?
- Yes. The method allows specifying the timescale, so you can retrieve values by days, weeks, or months depending on reporting needs.
Conclusion
Reading timephased data is crucial for understanding resource workload distribution and project cost dynamics over time. Using Aspose.Tasks for .NET, developers can efficiently extract and analyze both work and cost data from Microsoft Project files, enabling advanced reporting, forecasting, and decision-making — without requiring Microsoft Project itself.