Why no information in GUID field

If a task saved with ODBC to SQL and we can see each task has a GUID field and it is the identification for the task.

When I use Aspose.Task and found this field is blank? How to get this information it is better if we want to identify the task via programing.

Hopes can get help.

Hi Zhang,

Thank you for considering Aspose.Tasks.

Could you please share the sample file with us whose GUID information is not retrieved by Aspose.Tasks? I have tried it at my end by creating a new project file and setting GUID for its task. This project file was then saved to disc and read back with Aspose.Tasks for .NET 6.1.0. The GUID for the task is retained and displayed as well. Therefore, I assume that the issue is specific to your sample file only, which needs to be investigated further and reported if it is a bug.

Sample Code:

Project project = new Project(“New Project 2013.mpp”);
Task t = project.AddTask("Task 1");
t.GUID = Guid.NewGuid().ToString();
project.Save("Proj2013With Guid.mpp", SaveFileFormat.MPP);

//now read back the Task info
Project savedProj = new Project("Proj2013With Guid.mpp");

// Create a ChildTasksCollector instance
ChildTasksCollector collector = new ChildTasksCollector();
// Collect all the tasks from RootTask using TaskUtils
TaskUtils.Apply(savedProj.RootTask, collector, 0);
// Parse through all the collected tasks
foreach (Aspose.Tasks.Task tskCh in collector.Tasks)
{
    if (tskCh.Uid == t.Uid)
        Console.WriteLine("Task id: " + tskCh.Id + ", GUID: " + tskCh.GUID + ", Name:" + tskCh.Name);
}