Hi Team,
I want to read customized fields from the aspose tasks. Also, few columns like Resource Name, Tasks Mode which are inbuilt fields
Please tell me a way to read the same as I am unable to find all the columns in Tsk.
I am using the following way and on giving Tsk dot unable to find those columns in the list.
tsk.Get(Tsk.)
Thanks in advance
Regards
Hi Abhishek,
Thank you for contacting Aspose support team.
You may please use following sample code which displays all the required fields. Give it a try and share the feedback with us.
Project proj = new Project(path + "Sample.mpp");
ChildTasksCollector collector = new ChildTasksCollector(); // Create a ChildTasksCollector instance
TaskUtils.Apply(proj.RootTask, collector, 5); // Collect all the tasks from RootTask using TaskUtils
foreach (Task tsk in collector.Tasks)
{
//Read extended attributes
foreach (ExtendedAttribute att in tsk.ExtendedAttributes)
{
Console.WriteLine(tsk.Get(Tsk.Name) + ", Field Name = " + att.AttributeDefinition.FieldName + ", Value = " + att.Value);
}
//Read resource name
foreach (ResourceAssignment ass in tsk.Assignments)
{
Console.WriteLine("Resource Name = " + ass.Get(Asn.Resource).Get(Rsc.Name));
}
//Read Task Mode
bool bIsManual = tsk.Get(Tsk.IsManual);
if (bIsManual)
Console.WriteLine("Its Manual");
else
Console.WriteLine("Its Automatic");
}