We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How to fetch MPP in XML format

Hello There,

How can I fetch MPP in XML format using ASPOSE tool.

LearAspose Team


Please check MppToMpx demo for reference and
use WriteXML method instead of Write when save project.

Hello Alexey

Thanks for reply.

I have tried with the code which is given in Demo but getting error like ‘Could not read file’ please give me some sample code for that and actully I want all Task data into XML format. and also I don’t want that field which is not include in Task sheet.

Thanks in advance


Please provide example of MPP file you try to read.
In case you have MPP file created in MS Project 2007 these files are not supported yet.

Hello Alexey,

I am using MS Project 2003 not using 2007 here I am sending u mpp file which I want to convert in XML. I don't want whole Mpp converted into XML I want only Task data into XML file. Please do needful and reply asap as I am working on deadline..

Thanks in advance

Sorry for delay.

I have tested the file and I don’t have any problems with reading it using latest version of Aspose.Tasks.
So you can read project, parse it and create any XML file you need in case you don’t like standard xml file created by Aspose.Tasks.

Example of parsing you can find in the ProjectQuery. It parse projects and write results to standard output.
You can create similar code but write tasks data to XML.

Please, Can you send me the code ?

I get parsing error like ' Can not convert MPP to XML ' .

I know I have done silly mistake but cann't catch it.

Thanks & Regards

Aspose.Tasks can’t throw exception with such error message you posted.
Most probably your code throws it.

As I wrote there are 2 demos MppToMpx and ProjectQuery.
I use it to read mpp project file, parse it and write to xml.

If you still have problems please post your code here.

Hello There,

Here is the code to save Mpp to XML

Dim filename As String = fileBrowse.Value

’ Create an empty MPX file

Dim file As New XMLFile()

’ Configure the file to automatically generate identifiers for tasks.

file.AutoTaskID = True
file.AutoTaskUniqueID = True

’ Configure the file to automatically generate identifiers for resources.

file.AutoResourceID = True
file.AutoResourceUniqueID = True

’ Configure the file to automatically generate outline levels
’ and out1line numbers.

file.AutoOutlineLevel = True
file.AutoOutlineNumber = True

’ Configure the file to automatically generate WBS labels

file.AutoWBS = True

’ Configure the file to automatically generate identifiers for calendars

file.AutoCalendarUniqueID = True

’ Add a default calendar called “Standard”



If filename.Length = 0 Then
MsgBox("Usage: Aspose.Tasks.MppToMpx ")
Dim mpx As MPXFile = Nothing
Dim mpxml As XMLFile = Nothing
Dim fs As New FileStream(filename, FileMode.Open, FileAccess.Read)
mpx = New MPXFile(fs, Encoding.UTF8)
mpxml = New XMLFile(fs)
mpx = Nothing
End Try

If mpx Is Nothing Then
mpx = New MPPFile(filename)

Dim props As DocumentProperties = DirectCast(mpx, MPPFile).CustomDocumentProperties
Dim propCount As Integer = props.Count

For i As Integer = 0 To propCount - 1
Dim name As String = props.GetPropertyName(i)
Console.WriteLine(name + ": " + props(name).ToString())
Catch ex As Exception
mpx = Nothing
End Try

If mpx Is Nothing Then
mpx = New XMLFile(filename)
mpx = Nothing
End Try
End If
End If

If mpx Is Nothing Then
Throw New Exception(“Failed to read file”)
End If

’ Write the file

Dim fs1 As New FileStream(“c:\test.xml”, FileMode.OpenOrCreate, FileAccess.Write)
'declaring a FileStream and creating a document file named file with
'access mode of writing
Dim s As New StreamWriter(fs1)
'creating a new StreamWriter and passing the filestream object fs as argument

'writing text to the newly created file
End If
Catch ex As Exception
End Try

Please do needful

Thanks in advance


Is anyone there???

Waiting for your reply… You guys must be(everyday) on holidays.

If I’m not mistaken, I already answered your question. Shakeel also answered it.
Check Mpp2Mpx demo. Converting Mpp format to Xml is only 2 lines of code.

MpxFile mpx = new MPPFile (“project.mpp”);

If you need own xml format not compatible with MS Project that is your task to implement it and I can’t help.

Btw, code you provided is some strange combination of MpxCreate and Mpp2Mpx although I wrote about ProjectQuery and Mpp2Mpx demos.
That means you don’t parse project at all. Please check ProjectQuery demo again carefully.

In case you need XML with tasks only you can’t use WriteXML method and
should write own XML structure and write it to a file manually.