Question

I'm trying to update the duration field on tasks using CSOM, but the following is happening. If the task already has a duration value, then CSOM sets the new value without a problem. But if the task still doesn't have a value, then the new value added by CSOM, doesn't get saved.

This is my data:

enter image description here

For instance, if in the code I set the value of task "dois" to "2.00" then on the project schedule, I'll see "2d". However, if I in the code I set the value of "um" to "5.00", then when I check the schedule again, the duration field for "um" will still be blank. Furthermore, when I'm reading the duration value for "um" using CSOM, the value is actually "1d" and not blank as it appears on the project schedule.

Any ideas?

Was it helpful?

Solution 2

I got the answer from the MS Project forums: https://social.msdn.microsoft.com/Forums/en-US/b630513a-90eb-4a2a-9365-add100ff1b06/cant-set-duration-field-on-new-task-using-csom?forum=project2010custprog

Your problem is related to manual mode tasks. If you used Automatically Scheduled Tasks then the problem wouldn't occur. Manual mode should only be used for initial high level "I've no idea how long this will take" pictures. After that default auto.

You could try setting [Scheduled Duration] instead, but I still recommend not using Manual mode..

OTHER TIPS

This behaviour is not meet me before , but I will try to mention some hint to investigate and solve your issue:

  • Instead of updating the duration try to set the start date and end date and check if the duration field calculated correctly ,

  • Then check in your code How you add duration field , it should be a duration data type.

  • Also, check the type of scheduling is it auto schedule or manual schedule, it should be Auto.

  • Regarding "when I'm reading the duration value for "um" using CSOM, the value is actually "1d" and not blank" it's not mean you update it correctly. I think it's the default value of the duration field so try to add duration from code as 2 days and check also the retrieving value.

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top