Microsoft Project Data Reading and Writing Summary

Reading and Writing Microsoft Project Data with Aspose.Tasks for .NET

Aspose.Tasks for .NET provides an API for reading and writing Microsoft Project data programmatically. This page summarizes the capabilities of accessing and manipulating project data without having to install Microsoft Project software.

Reading Project Data

Aspose.Tasks allows developers to read project data from various sources:

Writing Project Data

The API supports comprehensive data writing capabilities:

Data Management Scenarios

Common scenarios for working with Microsoft Project data:

Code Examples

Below are basic examples of reading and writing Microsoft Project data:

 1    // Reading a project file
 2    Project project = new Project("Project.mpp");
 3
 4    // Accessing task data
 5    foreach (Task task in project.EnumerateAllChildTasks())
 6    {
 7        Console.WriteLine($"Task: {task.Name}, Duration: {task.Duration}");
 8
 9        // Access assignments
10        foreach (ResourceAssignment assignment in task.Assignments)
11        {
12            Console.WriteLine($"Assigned to: {assignment.Resource.Name}, Work: {assignment.Work}");
13        }
14    }
15
16    // Writing project data
17    Project newProject = new Project();
18    Task task1 = newProject.RootTask.Children.Add("Task 1");
19    task1.Duration = newProject.GetDuration(2, TimeUnitType.Day);
20    task1.Start = new DateTime(2023, 1, 10);
21    task1.Finish = new DateTime(2023, 1, 12);
22
23    // Save the project
24    newProject.Save("NewProject.mpp", SaveFileFormat.MPP);
Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.