J
JdZ
Hello,
I am trying to read the project structure from a .mpp file and import it
into an ERP system for billing hours.
The project structure may be
Task 1
--Task 1.1
----Task 1.1.1
----Task 1.1.2
--Task 1.2
----Task 1.2.1
----Task 1.2.2
Task 2
Task 3
--Task 3.1
--Task 3.2
I loop through the tasks using the following code to add it to a dataset.
foreach (MSProject.Task task in proj.Tasks)
{
row = dtTable.NewRow();
row["TaskID"] = task.ID;
row["TaskName"] = task.Name;
row["StartDate"] = task.Start;
row["EndDate"] = task.Finish;
row["Duration"] = task.Duration;
row["Notes"] = task.Notes;
if (task.OutlineChildren.Count == 0)
row["Type"] = "Task";
else
row["Type"] = "Subtask";
row["ParentID"] = ???????????????????? OR
row["IndentLevel"] = xxxxxxxxxxxxxxxxxx
dtTable.Rows.Add(row);
}
Now here is my question....
I want either the level of indentation, or the parent task id so I can
display the same heirachy in my application.
I have looked through the SDK and the elements of the MSProject.Task
variable with out any luck.
Any help would be appreciated.
JdZ
I am trying to read the project structure from a .mpp file and import it
into an ERP system for billing hours.
The project structure may be
Task 1
--Task 1.1
----Task 1.1.1
----Task 1.1.2
--Task 1.2
----Task 1.2.1
----Task 1.2.2
Task 2
Task 3
--Task 3.1
--Task 3.2
I loop through the tasks using the following code to add it to a dataset.
foreach (MSProject.Task task in proj.Tasks)
{
row = dtTable.NewRow();
row["TaskID"] = task.ID;
row["TaskName"] = task.Name;
row["StartDate"] = task.Start;
row["EndDate"] = task.Finish;
row["Duration"] = task.Duration;
row["Notes"] = task.Notes;
if (task.OutlineChildren.Count == 0)
row["Type"] = "Task";
else
row["Type"] = "Subtask";
row["ParentID"] = ???????????????????? OR
row["IndentLevel"] = xxxxxxxxxxxxxxxxxx
dtTable.Rows.Add(row);
}
Now here is my question....
I want either the level of indentation, or the parent task id so I can
display the same heirachy in my application.
I have looked through the SDK and the elements of the MSProject.Task
variable with out any luck.
Any help would be appreciated.
JdZ