Reputation: 99834
I have a MS Project file which I am using the Primary Interop Assemblies to parse. How can I determine the lineage of a task? I was relying on the WBS code, however the client has started to fiddle with this field and it no longer represents the hierarchy of the data.
Edit: By lineage I mean a way to identify where in the hierarchy the task exists. By default the WBS code mimics this perfectly.
I need this information to determine what is the parent for a task.
Example
The Lineage for B3 would be 2.3 (If we counted by 1, like project)
Upvotes: 0
Views: 791
Reputation: 125
Use 'OutlineChildren' property:
// from caller:
ListTasks(prj.OutlineChildren, "");
void ListTasks(Tasks lst, string indent)
{
foreach (Microsoft.Office.Interop.MSProject.Task t in lst) {
Log(indent + t.Start + " - " + t.Name);
ListTasks(t.OutlineChildren, indent + " ");
}
}
It creates indented tree of tasks.
Upvotes: 0
Reputation: 1376
Try the Task object's OutlineNumber property and the PredecessorTasks collection.
HTM
Colby Africa
Upvotes: 1