Search code examples
starteam

How to set the "Plan Work" (EstimatedHours) for a Task in StarTeam SDK?


I can't figure out how to set the EstimatedHours property from the StarTeam SDK. The property EstimatedHours is readonly, and I can't figure out any way to set the value from the SDK, though through the UI you can set the "Plan, Work" field.

Setting the EstimatedStart/Finish doesn't work:

var task = new Borland.StarTeam.Task(cr.ParentFolder);
task.Name = "Name";
task.Notes = "Notes";
// task.EstimatedHours = 4.0; // readonly property
task.EstimatedStart = DateTime.Now;
task.EstimatedFinish = DateTime.Now.AddHours(4);

task.Update();

Solution

  • The only way I have figured out to set the Estimated Hours was with database access and a SQL query:

    UPDATE t
       SET StTaskEstimatedHours = 4
    FROM dbo.syn_Task t
    WHERE t.EndModifiedTime = 0 AND t.DeletedTime = 0
      AND t.StTaskNumber = {task.Number}