Hi Lucas,
{
new License().SetLicense(@“E:\Aspose.Total.Net2015.lic”);
Tasks_600558(@“D:\Aspose\ProjectFormattedTasks.mpp”, true);
Tasks_600558(@“D:\Aspose\ProjectFormattedTasks1.mpp”, false);
Console.WriteLine(“Press any ket to continue…”);
Console.ReadKey();
}
static public void Tasks_600558(String FileName, bool bWrite)
{
Project prj = new Project(FileName);
ChildTasksCollector collector = new ChildTasksCollector(); // Create a ChildTasksCollector instance
TaskUtils.Apply(prj.RootTask, collector, 1); // Collect all the tasks from RootTask using TaskUtils
foreach (Task tsk in collector.Tasks)
{
Console.WriteLine("Id = " + tsk.Get(Tsk.Id));
Console.WriteLine("Uid = " + tsk.Get(Tsk.Uid));
Console.WriteLine("Guid = " + tsk.Get(Tsk.Guid));
}
if (bWrite)
prj.Save(@“D:\Aspose\ProjectFormattedTasks1.mpp”, SaveFileFormat.MPP);
}
Hi Lucas,
Hi Lucas,
- Open your Projeto1.mpp file in Microsoft Project (MSP) 2010 and just save it back with some other name. Now open both the MPP files and you will observe that GUIDs are different.
- Open your Projeto1.mpp in MSP 2013 and save it with some other name. Now open the newly saved MPP file and you will observe that all the GUIDs are changed similar to the GUIDs in the image sent by you here. Sometimes all the GUIDs contain similar values which is completely wrong behavior.
- Open the Projeto1.mpp file using Aspose.Tasks and save it with some other name as shown in the above sample code. Open the saved file in MSP 2010 and you will see that all the GUIDs are maintained which is the expected behavior.
- Open the saved file by Aspose.Tasks in MSP 2013 and you will see entirely wrong GUIDs similar to the output in point 2 above.
Hi Muhammad,
Hi Lucas,
Lucas Sepe:As you said, if I open a MPP file and save it in MS Project with "save" menu, the task's GUID are not recalculated.
Lucas Sepe:I just wanna do this with Aspose. How can I do this?
Hi Muhammad,
Hi Lucas,
logged this issue in our issue tracking system for analysis by the
development team as TASKS-33937. You will be automatically notified, once any update is
available in this regard.
Hi José,
We have investigated this issue at our end, however, no specific reason for the cause could be found. However, the same purpose can be achieved by saving the task’s GUID in one of the task’s custom text fields as shown in the code sample below. Please try it at your end and share your feedback with us.
Code:
static void CheckGuidIssue()
{
new License().SetLicense(@"Aspose.Tasks.lic");
Project project = new Project("Projecto1.mpp");
ChildTasksCollector coll = new ChildTasksCollector();
TaskUtils.Apply(project.RootTask, coll, 0);
ExtendedAttributeDefinition customField =
project.ExtendedAttributes.FirstOrDefault(x => x.FieldId.Equals(ExtendedAttributeTask.Text10.ToString("D")));
if (customField == null)
{
customField = CreateCustomField();
project.ExtendedAttributes.Add(customField);
}
customField.Alias = "Persistent GUID";
foreach (Task task in coll.Tasks)
{
ExtendedAttribute attr =
task.ExtendedAttributes.FirstOrDefault(x => x.FieldId.Equals(customField.FieldId));
if (attr == null)
{
attr = customField.CreateExtendedAttribute();
attr.Value = task.Get(Tsk.Guid);
task.ExtendedAttributes.Add(attr);
}
}
project.Save("saved.mpp", SaveFileFormat.MPP);
}
private static ExtendedAttributeDefinition CreateCustomField()
{
ExtendedAttributeDefinition field = new ExtendedAttributeDefinition();
field.FieldId = ExtendedAttributeTask.Text10.ToString("D");
return field;
}
Hi José,
Your concerns are valid and we already have requested further information about the possible rectification of the issue via API. We’ll update you here as soon as some feedback is available in this regard.
Hi José,
Hi José,
Thank you for being patient in this regard.
Our product team has investigated this issue further. Unfortunately, the issue can’t be fixed in near future. One thing is that Task’s Unique ID (UID) is persistent when “Save As” options is used and the combination of this UID and project file path can be a primary key in client’s database. Thus, this combination can also be used to preserve the task uniqueness with both “save” and “save as” operation for any project file on the client machine and can be used as a workaround for this issue.
The issues you have found earlier (filed as ) have been fixed in this Aspose.Words for JasperReports 18.3 update.