Saving Updated Resource Assignment to MPP
Contents
[
Hide
Show
]Aspose.Tasks for .NET supports updating resource assignment data and writing it back to a MPP file.
Updating Resource Assignments
To read, assign and save the updated file:
- Read an MPP file. The one used in this example contains one task and one resource without any assignments.
- Assign the resource to the task.
- Add the assigned resource to the project.
- Finally, save the project to the MPP file.
The code examples given below demonstrates how to perform these tasks.
1Project project = new Project("New Project.mpp");
2Task task = project.RootTask.Children.GetById(1);
3Resource resource = project.Resources.GetById(1);
4
5// Create resource assignment
6ResourceAssignment assignment = project.ResourceAssignments.Add(task, resource);
7assignment.Set(Asn.Notes, "Newly added assignment");
8
9project.Save("UpdateResourceAssignment_out.mpp", SaveFileFormat.MPP);