Asif
Asif

Reputation: 681

Reading and Writing to a Microsoft Project 2007 from C#

Is there any way of reading and writing the data from a Microsoft Project 2007 mpp file? I have an application that reads and writes data from a Project 2003 access database file. In order for this to work, I first save the Project 2003 mpp file as an Access database and my code can then read and write to the Access database. But Project 2007 does not allow you to save as an Access database file. I was wondering if there is any other method to get the data?

Upvotes: 2

Views: 7441

Answers (5)

Sujay Ghosh
Sujay Ghosh

Reputation: 2868

I would strongly suggest in using the MS Project object model. I had recently developed a MS Project addin, where in I had imported / exported from MS Project.

I am providing a sample below in C#.

MSProject.Tasks tasks = Globals.ThisAddIn.ProjectApp.ActiveProject.Tasks;

for (int TaskNo = 1; TaskNo <= tasks.Count; TaskNo++)
{
   string TaskName;
   TaskName = tasks[TaskNo].Name;

 // more code

}

Upvotes: 1

Shahzad Latif
Shahzad Latif

Reputation: 1424

Aspose.Tasks for .NET allows you to read and write data to Microsoft Project 2007. The data reading and writing operations can be performed easily using the simple API of this component. Also, it doesn't require MS Office to be installed on the machine running your application.

Disclosure: I work as developer evangelist at Aspose.

Upvotes: 1

Jon Iles
Jon Iles

Reputation: 2579

You may find MPXJ useful. It will allow you to read from MPP files, and a variety of file formats from Project and other planning applications. It will allow you to save your data as MPX or MSPDI files if you want to read it into Project again.

Jon

p.s.

Disclaimer: I maintain MPXJ.

Upvotes: 1

Colby Africa
Colby Africa

Reputation: 1376

You can use the Project Server Interface (PSI) to accomplish this. There is a full SDK available:

http://msdn.microsoft.com/en-us/library/ms512767.aspx

Check out the section on the reporting database as well:

http://msdn.microsoft.com/en-us/library/ms510779.aspx

Of course, you can always use the object model, but you will see performance problems when accsesing timephased data. The reporting databse denormalizes all timephased data into views that are very easy to query against.

Colby Africa http://colbyafrica.blogspot.com

Upvotes: 0

Nick Berardi
Nick Berardi

Reputation: 54854

You can use the .NET Office Interop to work with Microsoft Project 2007.

Upvotes: 2

Related Questions