Creating Resource Assignments

Resource assignments are linking tasks and resources. This article explains how to create resource assignments using Aspose.Tasks for C++.

Creating Resource Assignments

The Resource class exposes two different ways of creating a resource assignment, either using the default constructor or by passing a task and resource.

Programming Sample: Default Constructor Create a ResourceAssignment instance without requiring any parameters to be passed.

1// Create empty project
2System::SharedPtr<Project> project1 = System::MakeObject<Project>();
4// Add new task and resource
5System::SharedPtr<Task> task1 = project1->get_RootTask()->get_Children()->Add(u"Task");
6System::SharedPtr<Resource> rsc1 = project1->get_Resources()->Add(u"Rsc");
8// Assign the resource desired task
9System::SharedPtr<ResourceAssignment> assn = project1->get_ResourceAssignments()->Add(task1, rsc1);

Creating Multiple Resource Assignments

The following code example demonstrates how to set multiple resource assignments for one task and set user-defined start and end date for the resources.

Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.