Assignments Extended Attributes

Hi,

I’m almost finish a big project using Aspose but I still have some problems with adding extended values to assignments. Could you please tell me how to do it ? Extended values for tasks and resources work well!


My code:

Sub testPC()

Dim project As New Aspose.Tasks.Project()

project.StartDate = New DateTime(2010, 12, 15, 8, 0, 0)
project.FinishDate = New DateTime(2011, 12, 31, 17, 0, 0)
project.MinutesPerDay = 8 * 60
project.MinutesPerWeek = 5 * 8 * 60
project.DaysPerMonth = 20
project.DefaultStartTime = New DateTime(1, 1, 1, 8, 0, 0)
project.DefaultFinishTime = New DateTime(1, 1, 2, 17, 0, 0)
project.DurationFormat = TimeUnitType.Hour
project.WorkFormat = TimeUnitType.Hour

Dim task As New Aspose.Tasks.Task(“New Task”)
'task = project.AddTask(“New Task”)
task.Uid = project.NextTaskUid
task.Type = TaskType.FixedDuration
task.Start = New DateTime(2010, 12, 15, 8, 0, 0)
task.IsMilestone = True
task.Duration = New TimeSpan(0, 600, 0)
task.Finish = project.Calendar.GetFinishDateByStartAndWork(task.Start, task.Duration)
task.DurationFormat = TimeUnitType.Day
'task.Work = task.Duration
'task.RegularWork = task.Work

Dim ea As ExtendedAttribute = New ExtendedAttribute
'save number values goes to number 18
ea = New ExtendedAttribute
ea.FieldId = 188743994
ea.Value = 10000
task.ExtendedAttribute.Add(ea)

project.RootTask.Children.Add(task)

Dim res As New Aspose.Tasks.Resource
res = project.AddResource()
res.Name = “person1”
res.Id = 1
res.Work = New TimeSpan(50, 0, 0)
res.Start = New DateTime(2010, 12, 20)

Dim ass As New ResourceAssignment(task, res)

Dim eass As ExtendedAttribute = New ExtendedAttribute
'save number values goes to number 18
eass = New ExtendedAttribute
eass.FieldId = 255852754
eass.Value = 53
ass.ExtendedAttribute.Add(eass)
project.ResourceAssignments.Add(ass)


project.CalcTaskIds()
project.CalcResourceAssignmentIds()
project.CalcResourceIds()
project.UpdateReferences()

project.SaveVersion = 14
project.Save(“c:\testing.xml”, Saving.SaveFileFormat.XML)


End Sub

I did a test adding extended values manually (number18) on MS project and then saving it into XML format. The added value was saved inte the field 30 . Any idea of what is it ???

(I’m using aspose 7.3 I think)

Thank you!!!

Hi Jérôme,


Thank you for writing to Aspose support team.

At first, I would like to share with you that we have revamped the Aspose.Tasks API which is totally different than the legacy API and has better performance. I have tested this issue at my end using the latest version of Aspose.Tasks for .NET 8.2.0 and was assignment of Extended Attribute to Resource Assignment is working fine. Please have a look at the following code sample for your kind reference. I have also attached the output here for you reference.

We are not sure as why MSP is including the field in the output XML file. Aspose.Tasks doesn’t include this in the output XML and the output still works fine.

Code:

private static void Task_623995()
{
    Project project = new Project();
    project.CalculationMode = CalculationMode.Manual;
    Task task = project.RootTask.Children.Add(“Task 1”);

    ExtendedAttribute ea = new ExtendedAttribute();
    //save number values goes to number 18
    ea = new ExtendedAttribute();
    ea.FieldId = “188743994”;
    ea.Value = “10000”;
    task.ExtendedAttributes.Add(ea);

    Resource rsc1 = project.Resources.Add(“Resource 1”);
    rsc1.Set(Rsc.Type, ResourceType.Material);

    ResourceAssignment ass = project.ResourceAssignments.Add(task, rsc1, 3);
    ExtendedAttribute eass = new ExtendedAttribute();
    //save number values goes to number 18
    eass = new ExtendedAttribute();
    eass.FieldId = “255852754”;
    eass.Value = “53”;
    ass.ExtendedAttributes.Add(eass);

    project.Recalculate();
    project.Save(“saveFileName.xml”, Aspose.Tasks.Saving.SaveFileFormat.XML);
}

Thank you Muhammad for your answer.

I’ve developped a big code using the 7.4.0 version, so I can’t just migrate it easily. Can you please test the code using the 7.4.0 version please? I really need this to finish my software and I don’t understand why it doesn’t works!

Thank you

Hi Jérôme,

I have tried your code with Aspose.Tasks for .NET 7.3.0.1 and 7.4 both, however, there is no entry found like 30. Could you please explain step by step, how do you set extended attributes for resource assignment using Microsoft Project and how do you view those assignment extended attributes in MSP 2013?

You have mentioned that "It doesn't work!", where as it is observed that using Aspose.Tasks for .NET 7.3.0.1, 7.4 and 8.2, always the extended attributes are added to assignments and can be seen in the XML file. Also the un-necessary 30 is not found in the output XML as expected. Please describe in detail what feature does not work and what is the exact problem you are facing while adding the assignment extended attributes?

Hi Muhammad,

Yes, the assignement extended attributes are well created on the XML but the problem is when openning this XML on MS Project: the values are still 0. We are using the Number 18 in this case.

Ms project is not taking into account the XML assigment extended attributes values. It works fine for Tasks and Resources but not for assignments.

So, trying to understand why this problem, I did a test doing the inverse process. I created an assignement on ms project, and I filled the field number18 with a value of 30. Then I saved project into an XML format to see where the value of number18 goes .
That was the xml I sent you, it was ms project who created the field 30 not Aspose!

Aspose writes the correctly the extended attributes but I can’t see them on MS Project. I’ve verified the fieldID of number 18, is correct… I have the same problem with all the assignement extended attributes.

Could you test your XML on MS project? I opened it with MS Project 2010 and I have the same problem (look at the attached file)


Thank you for you help!

Hi Jérôme,

Thank you for sharing the feedback.

We were able to observe the issue as you have specified and it seems that Aspose.Tasks dosn’t support adding Extended Attribute to the ResourceAssignment the way MSP is handling it. The issue has been logged as TASKS-33987 for further investigation and possible implementation of the required functionality. We’ll notify you as soon as there is some update available in this regard.

Hi Jérôme,

I would like to share with you that the legacy version of Aspose.Tasks for .NET/Java have been discontinued. As per company policy, we published the legacy versions for three consecutive months and won’t be publishing any more versions of the legacy API. We recommend you to please convert your code to the revamped version of Aspose.Tasks for .NET to get all the fixes and enhancements incurred in new versions. Our documentation article, Migration from Legacy API, can help you convert your code. Please let us know if we can be of any help to you in this regard.

Thanks Kashif,

I’ll be wating for the solution because I need to deliver this project soon.

Hi Jérôme,

We’ll notify you here once the fix version is available for download. Meanwhile, you can convert your code to the new revamped API as the old API is no more supported and we won’t be able to provide you with a fix version in that regard.

The issues you have found earlier (filed as TASKS-33987) 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.