General Resource Assignment Properties

An assignment is a resource that has been assigned to a specific task. Each resource has general properties, typically a unique ID, a start and a finish time. This article explains how to set and get these properties with Aspose.Tasks.

Working with General Assignment Properties

The ResourceAssignment class exposes a number of properties used to set and get general assignment properties:

To see an assignment’s general properties in Microsoft Project:

  1. From the View menu, select Task Usage.
  2. From the Insert menu, select Column.
  3. Add the Start. Finish and Unique ID columns.

Setting General Resource Assignment Properties using Aspose.Tasks

The following example shows how to set these properties from scratch.

 1// Create empty project
 2Project project = new Project();
 4// Add new task and resource
 5Task task = project.RootTask.Children.Add("Task");
 6Resource resource = project.Resources.Add("Rsc");
 7resource.Set(Rsc.StandardRate, 10);
 8resource.Set(Rsc.OvertimeRate, 15);
10// Assign the resource desired task
11ResourceAssignment assignment = project.ResourceAssignments.Add(task, resource);

Getting General Resource Assignment Properties using Aspose.Tasks

The resource assignment properties can be accessed by traversing the project’s ResourceAssignments property.

1Project project = new Project("New Project.mpp");
3// Print general resource assignment properties
4foreach (ResourceAssignment ra in project.ResourceAssignments)
6    Console.WriteLine(ra.Get(Asn.Uid));
7    Console.WriteLine(ra.Get(Asn.Start).ToShortDateString());
8    Console.WriteLine(ra.Get(Asn.Finish).ToShortDateString());
Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.