How to Update Microsoft Project MPP Files

With Aspose.Tasks for .NET it is possible to update Microsoft Project (MPP/XML) files in addition to XML. You can save the updated data to an existing or a new file.

Updating Microsoft Project 2010 MPP Files

The following examples show how to add a new task to an existing Microsoft Project 2010 file and save it back to the same file. The code goes through the following steps:

  1. Create an instance of the project reader.
  2. Read the file.
  3. Create a task.
  4. Add the task to the project.
  5. Recalculate the project.
  6. Save.

The code snippets show the code first 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);
Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.