Hi,
I’m trying to work out the “Units” of a resource used for a task (e.g. 100%, 50%…).
I’m trying to use the “Work” of the resource divided by the task “Duration” (see below). However, this doesn’t always give me the same result as MS-Project’s UI. Can you please comment on my approach? Am I solving this problem the correct way?
Thanks in advance,
Ian
Project project = new Project("test.mpp");
foreach (Resource rsc in project.Resources)
{
ResourceAssignmentCollection rscAssignments = rsc.Assignments;
foreach (ResourceAssignment rsca in rscAssignments)
{
TimeSpan resourceWork = rsca.Get(Asn.Work).TimeSpan;
TimeSpan taskDuration = rsca.Get(Asn.Task).Get(Tsk.Duration).TimeSpan;
double units = (resourceWork.Ticks / taskDuration.Ticks) * 100;
}
}