Hi,
I’m exporting to an existing MS Project file (one that I would have generated new from Aspose Tasks during a previous export) of which I need to change the resource assigned to a task (simply change from Person 1 to Person 2). What is the proper way to do this?
Currently, I delete the assignment and add a new one with the proper resource. When I open up the exported project file the duration on this particular task is correct (e.g. 8 hours) but the finish date is 16 hours from the start. It seems as though the delete is not clearing the assignment and the adding of the new assignment with the new resource is causing the finish date to be pushed out by double the hours. Below is a sample of my code:
//I loop through to find the applicable assignment
_myAssignment = null;
foreach (ResourceAssignment _assignment in _myMSProject.ResourceAssignments)
{
if (_assignment.Get(Asn.Uid) == _myTask.Get(Tsk.Uid))
{
_myAssignment = _assignment;
break;
}
}
//I then delete the assignment
_myAssignment.Delete()
//I then add a new assignment with the updated resource
_myAssignment = _myMSProject.ResourceAssignments.Add(_myTask, myNewResource);
I’m using Aspose.Tasks for .Net version 19.1, exporting to MS Project 2010 and developing via VS 2017.
Thanks, Calvin