Free Support Forum - aspose.com

How to retrive or read data of %complete field and Duration and another own created field

Hi,
I want to know what will be the exact code of retrieve or read data of %complete field and Duration and another own created field.I can not read these field data from MS Project with aspose.
Please help me ASAP…

Hi,

You can use PercentComplete, Duration and ExtendedAttribute APIs to read % complete, duration and custom fields respectively as you can see in the following example.

Aspose.Tasks.License lic = new License();<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

lic.SetLicense(@"Aspose.Total.Product.Family.lic");

ProjectReader reader = new ProjectReader();

Project project = reader.Read("Project1.mpp");

ChildTasksCollector collector = new ChildTasksCollector();

TaskUtils.Apply(project.RootTask, collector, 0);

foreach (Task task in collector.Tasks)

{

Console.WriteLine(task.Duration);

Console.WriteLine(task.PercentComplete);

foreach (ExtendedAttribute extendedAttribute in task.ExtendedAttribute)

{

Console.WriteLine(extendedAttribute.AttributeDefinition.FieldName + " :" + extendedAttribute.Value);

}

}

Console.ReadLine();

Please feel free to contact us in case you have further comments or questions.

Best Regards,