When adding a Resource Cost to a Task and setting the “Cost”, the value assign to Cost does NOT get save to MS Project. Any work around?
BTW, I’m using version 9.3 and MS Project 2013.
Thank you for writing to Aspose Support team.
Microsoft Project doesn’t allow to set Cost for a resource of Cost Type and the same behavior is implemented by Aspose.Tasks API as well. In order to do so, please set the cost for the resource assignment of the task. I have made some changes in your code that are highlighted in yellow. Please try these at your end and let us know your feedback.
Sample Code Changes:
Resource resCost = proj.Resources.Add(“ResourceCost”); resCost.Set(Rsc.IsCostResource, true); // Change Resource Type to ‘Cost’ //resCost.Set(Rsc.Cost, 33); // does NOT get save to MS Project 2013. ResourceAssignment assn1 = proj.ResourceAssignments.Add(eventTask, resCost); assn1.Set(Asn.Cost, 33); MPPSaveOptions mppSaveOptions = new MPPSaveOptions(); mppSaveOptions.WriteViewData = true;
That did it! Thank you very much!
You are welcome.
I’m expecting the Resource Cost of $100 displayed in brackets when viewed in Ghantt.
The attached code works with fresh install of MS Project 2013. But when Microsoft Updates are installed, it will no longer display the resource cost in brackets.
Any ideas? I’ve tried a number of combinations and currently using the version 16.11
See attached code.
this code will no longer work when Microsoft UPDATES are installed.
Thank you for contacting Aspose Support team.
We have investigated your shared sample code and were able to observe the issue specifically in Microsoft Project 2013. We have logged this issue for further analysis by our product team under Id: TASKSNET-1749. We’ll let you know once there is any further progress or a fix version available in this regard.
Uninstallig update KB3127978 works!!!