MPX & MPP files


#1

Hi there.

Is there a way I can open an MPP file, do my manipulations and then save it as an MPX? I have a client that needs me to provide this functionality.

Thanks for any help you can provide. :slight_smile:


#2

Hello,

Thanks for your consideration.

Shure, you can write something like that in C#:

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

Tasks allTasks = mpp.AllTasks;
System.Collections.IEnumerator iter = allTasks.GetEnumerator();

if (iter.MoveNext() == true)
{
Task task = (Task)(iter.Current);

Task newtask1 = task.AddTask();
newtask1.Name = “First New Task”;
newtask1.Duration = new Duration(10, TimeUnit.Days);
newtask1.Start = new System.DateTime(2003, 1, 1);

Task newtask2 = task.AddTask();
newtask2.Name = “Second New Task”;
newtask2.Start = new System.DateTime(2003, 1, 11);
newtask2.Duration = new Duration(10, TimeUnit.Days);

Relation rel1 = newtask2.AddPredecessor(newtask1);
rel1.Type = TaskLinkType.FinishToStart;
}

mpp.Write(“project.mpx”);


or the same example in Visual Basic:


Dim mpp As MPPFile = New MPPFile(“project.mpp”)

Dim allTasks As Tasks = mpp.AllTasks
Dim iter As System.Collections.IEnumerator = allTasks.GetEnumerator()

If iter.MoveNext() = True Then
Dim task As Task = CType((iter.Current), Task)

Dim Newtask1 As Task = task.AddTask()
Newtask1.Name = "First New Task"
Newtask1.Duration = New Duration(10, TimeUnit.Days)
Newtask1.Start = New System.DateTime(2003, 1, 1)

Dim Newtask2 As Task = task.AddTask()
Newtask2.Name = "Second New Task"
Newtask2.Start = New System.DateTime(2003, 1, 11)
Newtask2.Duration = New Duration(10, TimeUnit.Days)

Dim rel1 As Relation = Newtask2.AddPredecessor(Newtask1)
rel1.Type = TaskLinkType.FinishToStart
End If

mpp.Write(“project.mpx”)


#3

You wrote:

>Shure, you can write something like that in C#:
>
>MPPFile mpp = new MPPFile (“project.mpp”);
>[…stuff…]
>mpp.Write(“project.mpx”);

Does this mean that it’s ONLY possible to write an MPX file? Put another way, does the MPP interface only read the files and leave the output to the MPX class?

Thanks,

Trevor


#4

Hello Trevor,

Thanks for your consideration.

Yes, that’s true. You can write projects in MPX format only.

Please read my post. I think it can be interesting for you.
http://www.aspose.com/forums/ShowPost.aspx?PostID=6108#6144


#5

Thanks alcrus. What version of Project started with the MPX format? Even more specifically, what is the earliest version of Project that can read the files created by the Aspose.Project component?

Is the Project version feature support documented anywhere? Can we tell which properties are going to be supported by a particular version of Project?

Thanks,
Trevor


#6

Hello Trevor,

Thanks for your consideration.

You mean earliest version of MS Project?
Last MPX (4.0) format supported from version 4.0 of MS Project.
So teoretically you can use MS Project 4.0, 4.1, 98, 2000, 2002 and 2003.

MPX format supports:

1. Calendars
Up to 7 CalendarHours for each Calendar
Up to 250 CalendarPeriods for each Calendar

2. Main properties
Project tab
Company
Manager
Calendar
Start Date
Finish Date
Schedule From (0 = start, 1 = finish)
Current Date*
Comments
Cost*
Baseline Cost*
Actual Cost*
Work*
Baseline Work*
Actual Work*
Work*
Duration*
Baseline Duration*
Actual Duration*
Percent Complete*
Baseline Start*
Baseline Finish*
Actual Start*
Actual Finish*
Start Variance*
Finish Variance*
Subject
Author
Keywords

* These fields are calculated by Microsoft Project, so imported values are ignored.

3. Resources
% Work Complete
Accrue At
Actual Cost
Actual Work
Base Calendar
Baseline Cost*
Baseline Work*
Code
Cost*
Cost Per Use
Cost Variance*
Email Address
Group
ID
Initials
Linked Fields*
Max Units
Name
Notes
Objects*
Overallocated*
Overtime Rate
Overtime Work*
Peak*
Remaining Cost*
Remaining Work*
Standard Rate
Text1
Text2
Text3
Text4
Text5
Unique ID
Work*
Work Variance*

* These fields are calculated by Microsoft Project, so imported values are ignored.

4. Resource notes

5. Resource calendars

6. Tasks
% Complete
% Work Complete
Actual Cost
Actual Duration
Actual Finish
Actual Start
Actual Work
Baseline Cost
Baseline Duration
Baseline Finish
Baseline Start
Baseline Work
BCWP
BCWS
Confirmed
Constraint Date
Constraint Type
Contact
Cost
Cost1
Cost2
Cost3
Cost Variance*
Created*
Critical*
CV*
Delay
Duration
Duration1
Duration2
Duration3
Duration Variance*
Early Finish*
Early Start*
Finish
Finish1
Finish2
Finish3
Finish4
Finish5
Finish Variance*
Fixed
Fixed Cost
Flag1
Flag2
Flag3
Flag4
Flag5
Flag6
Flag7
Flag8
Flag9
Flag10
Free Slack*
Hide Bar
ID
Late Finish*
Late Start*
Linked Fields*
Marked
Milestone
Name
Notes
Number1
Number2
Number3
Number4
Number5
Objects*
Outline Level
Outline Number
Predecessors
Priority
Project
Remaining Cost
Remaining Duration
Remaining Work
Resource Group*
Resource Initials
Resource Names
Resume
Resume No Earlier Than
Rollup
Start
Start1
Start2
Start3
Start4
Start5
Start Variance*
Stop
Subproject File
Successors
Summary*
SV*
Text1
Text2
Text3
Text4
Text5
Text6
Text7
Text8
Text9
Text10
Total Slack*
Unique ID
Unique ID Predecessors
Unique ID Successors
Update Needed
WBS
Work
Work Variance*

* These fields are calculated by Microsoft Project, so imported values are ignored.

7. Task notes

8. Recurring tasks

9. Resource assignments
ID
Units
Work
Planned Work
Actual Work
Overtime Work
Cost
Planned Cost
Actual Cost
Start*
Finish*
Delay
Resource Unique ID

* Since these fields are calculated by Microsoft Project, imported values are ignored.