Write outline codes with mpxj to a xml file and import it to ms project 2003/2007
-
26-05-2021 - |
Frage
Has anybody got mpxj and outlince codes to work with ms project 2003 or 2007?
I tried to export outline codes with the following code:
ProjectFile project = new ProjectFile();
Task task = project.addTask();
task.setOutlineCode1("outlineCode1");
The resulting xml looked something like this:
<Project xmlns="http://schemas.microsoft.com/project">
..
<ExtendedAttributes>
<ExtendedAttribute>
<FieldID>188744096</FieldID>
<FieldName>Outline Code1</FieldName>
</ExtendedAttribute>
</ExtendedAttributes>
..
<Tasks>
<Task>
..
<ExtendedAttribute>
<FieldID>188744096</FieldID>
<Value>value</Value>
</ExtendedAttribute>
..
</Task>
</Tasks>
</Project>
But i could not find any outline codes in the imported project ..
When i add outline codes to a project manually, the resulting xml file also looks different from the above:
<Project xmlns="http://schemas.microsoft.com/project">
..
<OutlineCodes>
<OutlineCode>
<FieldID>188744096</FieldID>
<FieldName>Outline Code1</FieldName>
<Values>
<Value>
<ValueID>1</ValueID>
<ParentValueID>0</ParentValueID>
<Value>value</Value>
</Value>
..
</Values>
..
</OutlineCode>
</OutlineCodes>
..
<ExtendedAttributes>
<ExtendedAttribute>
<FieldID>188744096</FieldID>
<FieldName>Outline Code1</FieldName>
</ExtendedAttribute>
</ExtendedAttributes>
..
<Tasks>
<Task>
..
<OutlineCode>
<UID>1</UID>
<FieldID>188744096</FieldID>
<ValueID>1</ValueID>
</OutlineCode>
..
</Task>
</Tasks>
</Project>
So it seems to me that i am missing some important steps in the export procedure?!
Lösung
I've looked through the source of MPXJ and done a quick test of my own, and it doesn't look like you are doing anything wrong. As far as I can tell it just doesn't support OutlineCodes in the way that MS Project needs.
As you discovered, it outputs them as normal ExtendedAttributes
, but the MSPDI schema defines a set of OutlineCode
elements specifically for storing these (as you can see in the xml created by MS Project). Actually, the OutlineCode
element stores a reference to a lookup value defined in the Project, rather than storing the value directly.
Your best bet is to log a bug over on SourceForge, and get Jon (the creator) to have a look.