How to Update Microsoft Project MPP Files

Aspose.Tasks for .NET not only allows reading Microsoft Project files but also updating and saving them programmatically. This is useful when you need to automate project updates, such as adding new tasks, modifying resources, or recalculating schedules, without relying on Microsoft Project’s UI.

With Aspose.Tasks, you can update Microsoft Project (MPP/XML) files and save the updated data either into the same file or into a new one. This ensures flexibility for both incremental changes and creating modified project copies.

Updating Microsoft Project 2010 MPP Files

The following example demonstrates how to add a new task to an existing Microsoft Project 2010 file and save it back to the same file. This is a common use case when you need to extend an existing project with new activities while preserving all the original data.

The code goes through these steps:

  1. Create an instance of the project reader.
  2. Load the existing MPP file.
  3. Create a new task programmatically.
  4. Add the task to the project’s task hierarchy.
  5. Recalculate the project to ensure dates and dependencies remain consistent.
  6. Save the updated file.

The following code snippet shows how to achieve this in C#:

1Project project = new Project("New Project.mpp");
2
3// Create a new task
4Task task = project.RootTask.Children.Add("Task1");
5
6task.Set(Tsk.Start, new DateTime(2012, 8, 1));
7task.Set(Tsk.Finish, new DateTime(2012, 8, 5));
8
9project.Save("AfterLinking_out.mpp", SaveFileFormat.MPP);

Using Aspose.Tasks for .NET, you can seamlessly update Microsoft Project files (MPP/XML) in the background of your applications. This allows developers to automate project management processes — such as inserting new tasks, adjusting schedules, or updating resource assignments — without manual interaction in Microsoft Project. By recalculating and saving changes programmatically, you ensure data consistency while boosting productivity in project-driven workflows.

Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.