How to write the OutlineLevel

Hi,

Do CalcTaskIds and CalcTaskUids reset OutLineLevel.Property value? If I call CalcTaskIds and CalcTaskUids after setting the Task.OutLineLevel.Property value, the value is set to "1".

How do I set the outline level?



Task task = new Task("test1");

task.OutlineLevel = 1;

Task task2 = new Task("test2");
task2.OutlineLevel = 2;

Project project = new Project();

project.RootTask.Children.Add(task);
project.RootTask.Children.Add(task2);

project.CalcTaskIds();
project.CalcTaskUids();

ProjectWriter prjWriter = new ProjectWriter();
prjWriter.Write(project, "test.xml", TasksDataFormat.XML);

Hi,

Just try task.Children.Add(task2); instead of project.RootTask.Children.Add(task2); as all root task’s children have outline level 1. Root task has outline level 0, it’s children have outline level 1, grandchildren have outline level 2 and so on.

You can use the code below:

Project project = new Project();
Task task = new Task("test1");
Task task2 = new Task("test2");
project.RootTask.Children.Add(task);
task.Children.Add(task2);
project.CalcTaskIds();
project.CalcTaskUids();
ProjectWriter prjWriter = new ProjectWriter();
prjWriter.Write(project, "test.xml", TasksDataFormat.XML);

The project.CalcTaskIds() recalculates outline level values.