How to retrieve perticular task Guid using Aspose.Task

Dear Support team ,

I am testing the trial version of Aspose.task. I need to get the task guid for some particular task. There is no method available if i am not wrong. can you please guide me ?

Regards,
Madni

Hi Madni,


You can see some discussion of the issue in this thread.The task’s UID is a unique number so you can identify the task by it. For xml it is the only way as MS Project 2003/2007/2010 xml files do not contain task guid elements.

I have created a new issue ‘Read task’s GUID from MS Project MPP files.’ with ID = 15733 and linked it to this thread. We are planning to resolve the issue for MS Project 2007 MPP files in next release (end of April). Some additional investigation for other formats (2003/2010 MPP) is required.

Sorry for inconvenience.

Dear Sergey,

Many thanks for your satisfactory reply. One more problem that i am facing using the following code :

ProjectReader rdr = new ProjectReader();


FileStream St = new FileStream(“c:\test.mpp”, FileMode.Open);


Project prj = rdr.Read(St);


St.Close();


ArrayList alTasks =
prj.RootTask.Children;


foreach (Task tskCh in alTasks)


{


//i am only getting top level task in this loop instead of having all the tasks


}


I am only getting the top level task instead of having all the children tasks. Is it the limitation of the trial version ?

Regards,
Madni

Hi Madni,


Not, there are no any limitation at all when you use Aspose.Tasks with one month trial license. And converting dates to 2000 year is the only restriction when you use Aspose.Tasks without any license (evolution).

Project tasks are organized in a tree structure as you can see them in MS Project, so if you have one top level summary task the code returns just it. You can use Children property again to move one step down.

Aspose.Tasks provides some methods to run through all task or some filtered tasks. You can find some samples (Aspose.Tasks.FilterByName, Aspose.Tasks.FindByName) in Aspose.Tasks installation folder (Featured Demos subfolder) on your PC. Aspose.Tasks.Util namespace is used. You can find some documentation here.

As a variant you can create your own recursive method to run through all tree leaves.

Hi sergey ,

I have just gone through the documentation for the class childtaskscollector. How would i use its functions so as to get the tasks collection ?

Hi Madni,

You can use it as an ITreeAlgorithm parameter for TaskUtils.Apply
method:

using System;
using System.Collections;
using System.Text;
using Aspose.Tasks;
using Aspose.Tasks.Util;

namespace ChildTaskCollectorSample
{
    class Program
    {
        static void Main(string[] args)
        {
            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.Name);
            Console.WriteLine("Press ENTER to exit.");
            Console.ReadLine();
        }
    }
}

See a resulting screenshot below.

Hi Madni,


Using last Aspose.Tasks 2.8.0 version you can get task’s Guid when you read your project data from MS Project 2007 MPP file. You can use a Task’s GUID property for it, it returns the Guid as string.

You can download the latest version here.

For MS Project 2003/2010 the feature is still under development.

The issues you have found earlier (filed as 15733) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.

The issues you have found earlier (filed as ) have been fixed in this Aspose.Words for JasperReports 18.3 update.