How to Update Microsoft Project MPP Files
Contents
[
Hide
Show
]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:
- Create an instance of the project reader.
- Read the file.
- Create a task.
- Add the task to the project.
- Recalculate the project.
- 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);