If I call CalcTaskIds and CalcTaskUids after setting the Task.OutLineLevel.Property value, the value is set to “1”.
This problem was treated in a old post (<a href="https://forum.aspose.com/t/4858#576371)
- So, how do I set the outlinelevel? There are more than 2 levels!
My code is a loop. Tasks information is stored in a database table, including outline level/number, summary task. So I read each line (each task) and add the task to a the project : project.RootTask.Children.Add(taskMSP)
Do While Not adoORACLE.EOF
Dim taskMSP As New Aspose.Tasks.Task
'taskMSP = prjMSP.AddTask()
taskMSP.Id = adoORACLE(“TASK_ID”).Value
taskMSP.Uid = adoORACLE(“TASK_UID”).Value
taskMSP.Name = adoORACLE(“TASK_NAME”).Value
taskMSP.Type = adoORACLE(“task_type”).Value
If Not IsDBNull(adoORACLE(“TASK_CONSTRAINT_TYPE”).Value) Then taskMSP.ConstraintType = adoORACLE(“TASK_CONSTRAINT_TYPE”).Value
If Not IsDBNull(adoORACLE(“TASK_CONSTRAINT_DATE”).Value) Then taskMSP.ConstraintDate = adoORACLE(“TASK_CONSTRAINT_DATE”).Value
If IsDBNull(adoORACLE(“TASK_DUR”).Value) = False Then
If adoORACLE(“TASK_DUR”).Value = 0 And adoORACLE(“TASK_IS_MILESTONE”).Value = 0 Then
taskMSP.Duration = New TimeSpan(0, 0, 1)
Else
taskMSP.Duration = New TimeSpan(adoORACLE(“TASK_DUR”).Value / 10 / 60, 0, 0)
End If
taskMSP.DurationFormat = TimeUnitType.Day
End If
taskMSP.Start = adoORACLE(“TASK_START_DATE”).Value
taskMSP.Finish = adoORACLE(“TASK_FINISH_DATE”).Value
taskMSP.OutlineLevel = adoORACLE(“task_outline_level”).Value
If Not IsDBNull(adoORACLE(“task_is_summary”).Value) Then taskMSP.DisplayAsSummary = adoORACLE(“task_is_summary”).Value
'Not baseline???
If IsDBNull(adoORACLE(“task_act_start”).Value) = False And IsDBNull(adoORACLE(“task_act_finish”).Value) = False Then
taskMSP.ActualStart = adoORACLE(“task_act_start”).Value
taskMSP.ActualFinish = adoORACLE(“task_act_finish”).Value
taskMSP.PercentComplete = adoORACLE(“task_pct_comp”).Value
End If
taskMSP.IsMilestone = adoORACLE(“task_is_milestone”).Value
taskMSP.IsEffortDriven = adoORACLE(“task_is_effort_driven”).Value
If Not IsDBNull(adoORACLE(“task_is_rolled_up”).Value) Then taskMSP.IsRollup = adoORACLE(“task_is_rolled_up”).Value
prjMSP.RootTask.Children.Add(taskMSP)
adoORACLE.MoveNext()
Loop