General Resource Assignment Properties

A resource assignment represents a resource linked to a specific task. Each assignment has basic general properties such as a unique identifier, start date, and finish date. Aspose.Tasks for .NET allows developers to programmatically set and retrieve these properties, providing more control over project management automation.

Working with General Assignment Properties

The ResourceAssignment class exposes several key properties:

To view assignment properties in Microsoft Project manually:

  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

In the following example, we create a resource assignment from scratch and set its unique ID, start date, and finish date. This is useful when initializing new assignments programmatically.

 1// Create empty project
 2Project project = new Project();
 3
 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);
 9
10// Assign the resource desired task
11ResourceAssignment assignment = project.ResourceAssignments.Add(task, resource);

Getting General Resource Assignment Properties using Aspose.Tasks

The next example demonstrates how to read general assignment properties by iterating through the ResourceAssignments collection in a project. This approach is typically used when analyzing or reporting existing project data.

1Project project = new Project("New Project.mpp");
2
3// Print general resource assignment properties
4foreach (ResourceAssignment ra in project.ResourceAssignments)
5{
6    Console.WriteLine(ra.Get(Asn.Uid));
7    Console.WriteLine(ra.Get(Asn.Start).ToShortDateString());
8    Console.WriteLine(ra.Get(Asn.Finish).ToShortDateString());
9}

FAQ

Q: Do I need Microsoft Project installed to read or edit general assignment properties?

Q: Can I set both start and finish dates programmatically?

Q: Will changes to UID, Start, or Finish be preserved in Microsoft Project after saving?

Conclusion

General resource assignment properties such as UID, Start, and Finish are fundamental for project scheduling. With Aspose.Tasks for .NET, you can easily set or retrieve these values programmatically, making it simple to automate project workflows, validate assignments, or generate reports—all without depending on Microsoft Project.

Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.