I'm exporting an mpx file from my web app. and can create my tasks and assign my resources to each task. For each resource I use the following code:
Resource resource; //cast resource from the aspose resource collection in the mpxfile and set properties resource = (Resource)mpxFile.AllResources; resource.MaxUnits = 75.00; resource.Peak = 75.00; //assign resource asposeTask.AddResourceAssignment(resource);
The resource is added to the resource assignments on the task fine but no matter what I set the Peak to, every resource has a unit of 100% when I view the task data in MS Project Pro 2003. The MaxUnits value works fine when I view the Resource Sheet in MS Project? Is there another property I have to set to make the Peak units appear?
Please can you advise on why this is happening as soon as possible please.
The most simple way to check is create resource with correct MaxUnit in MS Project. After that open it with Aspose.Tasks and check in debugger what properties are set. Probably you should set some start or end dates… I will check it.
For your information I set all the following on every task I create:
Name Start Finish Duration PercentComplete ConstraintType Type
Any Predecessors that the task may own and also the resources.
I have done the same in reverse, by that I mean importing an MPP file into my webpage and stepped through the code in the debugger. The Peak property is definitely what is set from MS Project when you give a resource say 80% in the units field of the TaskData dialogue.
Thanks for the reply but do you have a workaround?
There must be a way of allocating a resource at say 80% for one task and maybe 50% for another task. I can't see how or why MS Project would calculate this everytime you open a mpx file, there must be something which is not being set in the ASPOSE task object?? Being able to import resourcing is a fundamental part of how we need to use ASPOSE from our website.
It was unclear from your API reference exactly how I should have assigned a resource to a task. I didn't realise the AddResourceAssignment(Resource resource) method returned a ResourceAssignment object which could then have it's properties set.