Hi,
I should export data of a Gantt to MSProject, but I need to add a “Description” field.
So
I followed the guide to add a ExtendedAttribute and partly working, because is actually written in XML output, but when I opened the XML file in
MSProject the custom field is not visible.
However if I manually add the field “Description (Text1)” I see the field values that I set in the source code.
There is a way to make the field visible when the XML file is open in MSProject?
This is the code I used:
Dim attr As ExtendedAttribute
Dim eas As ArrayList
Dim ead As ExtendedAttributeDefinition
Dim eads As ArrayList
eads = prj.ExtendedAttributes
If eads Is Nothing Then
eads = New ArrayList()
prj.ExtendedAttributes = eads
End If
ead = New ExtendedAttributeDefinition()
ead.FieldId = CType(ExtendedAttributeTask.Text1, Integer).ToString
ead.Alias = "Description"
eads.Add(ead)
For Each row As DataRow In dtTasks.Rows
tsk = New Task(row("IDNRR"))
tsk.Uid = row("Uid")
tsk.Start = row("Start")
tsk.DurationFormat = TimeUnitType.Day
tsk.Duration = row("Duration")
eas = tsk.ExtendedAttribute
If eas Is Nothing Then
eas = New ArrayList()
tsk.ExtendedAttribute = eas
End If
attr = New ExtendedAttribute()
attr.FieldId = ead.FieldId
attr.Value = row("Description").ToString
eas.Add(attr)
rootTsk.Children.Add(tsk)
Next