Free Support Forum - aspose.com

Native MS XML Format/Time Phased Data

Hello, I would like to ask a question about Aspose.Tasks.

We have a customer who uses Project 2003. I have a connector that will process Microsoft's default Project 2003 XML format. When I save a project file to XML from Project 2003 , it saves everything including the TimephasedData, which the connector I'm using requires in order to properly process the tasks into my database schema.

In your product, if I open the MPP file and call XMLWrite, it writes everything except the TimephasedData portion. I noticed under your Aspose.Tasks.XML namespace that TimephasedData is included in the object model. Is there anyway that I can open an MPP fille with your product and:

  1. Save it to the native Microsoft Project XML format which includes TimePhasedData?
  2. Cast/Translate from an MPPFile to the Aspose.Tasks.XML namespace object model to get access to the TimePhasedData in that manner?

We would very much like to use your product going forward, however, I cannot use a product that doesn't give me access to the TimephasedData from an .MPP format. I am trying to save my customer's the trouble of having to export it manually and it will also save transmission time to our servers seeing as the XML format is much larger than the MPP.

Thanks very much,

Alex Robson

The main problem is TimephasedData fields are not supported.
I will check if we can implement it quickly.

Can this feature be implemented? If so, can you give an estimate on it will be available?

I added timephased data to our planes for the next month.

Unfortunately, this is something that I need available to me now. I noticed that this does exist in the xml namespace but I am not sure how to use this namespace. Can you give me a sample project that uses this namespace or does any documentation other than the API exist for this namespace?

After you saved your project in XML format (without timephased data) you should open it again with standard XMLSerializer.

TextReader reader = new StreamReader(input_stream);
XmlSerializer serializer = new XmlSerializer(typeof(Aspose.Tasks.XML.Project));
Aspose.Tasks.XML.Project project = (Aspose.Tasks.XML.Project)serializer.Deserialize(reader);

Check API for XML.Project class. It has manu properties and collections.
The main collections you can use are Calendars, Tasks, Resources and Assignments.
Timephased data can be stored in each Assignment. For example you need to add new timephased data.

At first you shour find Assignment you need to change. For example it’s a first one.

Aspose.Tasks.XML.Assignment assg = project.Assignments[0];

Now you can add timephased objects and set properties.

Aspose.Tasks.XML.TimephasedDataTypeColection tds = assg.TimephasedDataCollection;
if (tds == null)
{
tds = new Aspose.Tasks.XML.TimephasedDataTypeCollection();
assg.TimephasedDataCollection = tds;
}
Aspose.Tasks.XML.TimephasedDataType td = new Aspose.Tasks.XML.TimephasedDataType();

tds.Add(td);
td.Type = Type.AssignmentRemainingWork; // 1
td.UID = 1; // Probably equal to Assignment’s UID or may be own one
td.Start = new DateTime(2006, 03, 27, 8, 0, 0);
td.Finish = new DateTime(2006, 03, 28, 8, 0, 0);
td.Unit = Unit.Days; // 2
td.Value2 = “PT8H0M0S”; // time period, 8 hours in our case.
// You shouldn’t set Value2 for non-working days or you can set it to "PT0H0M0S"

Timephased datas should be added for each day. You can save project in XML
format with MS Project and check what values should be set.
Hope this small example will help you.

So, currently I can’t read a xml file with timephased data?

You can read such xml files but you can’t read timephased data.
Just through reading file directly with Aspose.Tasks.XML classes.