Retrieve Project Task data and their field names including custom fields

Hi I would like to get all the task data from my MPP file, plus their column field headings including the custom ones. it possible to do this without knowing what the columns field heading names are called? If this is not possible is their a way by stating the column field heading names?

Hi Faisal,


Thank you for writing to Aspose support.

Following is the sample code which can be used to display all the column titles for which data is available in the MPP file. Also it displays the extended attributes and value in the respective field.

static public void ReadCompleteDataFromMpp()
{
Project prj = new Project(@“D:\Aspose\Customer Service as 2003.mpp”);

// Create a ChildTasksCollector instance
ChildTasksCollector collector = new ChildTasksCollector();

// Collect all the tasks from RootTask using TaskUtils
TaskUtils.Apply(prj.RootTask, collector, 0);
GanttChartView view = prj.Views.ToList()[1] as GanttChartView;

foreach(TableField tbFld in view.Table.TableFields)
{
Console.WriteLine(tbFld.Field.ToString());
// Here name of all the fields is available. Implement switch case logic to display values

}

// Parse through all the collected tasks
foreach (Aspose.Tasks.Task tsk in collector.Tasks)
{
List eas = tsk.ExtendedAttribute;
if (eas != null)
{
foreach (ExtendedAttribute ea in eas)
{
Console.WriteLine(ea.AttributeDefinition.FieldName);
Console.WriteLine(ea.FieldId);
Console.WriteLine(ea.Value);
Console.WriteLine(ea.ValueGuid);
}
}
}
}

Please feel free to write us back if you have any other query in this regard.