0

I need to find a way to automate the process when a user uploads a microsoft project file to a web application I already have created. The process will need to basically use the save as from project to save into a .csv file so I can use this to import the data to an SQL database (this is needed for custom reporting we already have set up using SQL). I need to automate this process because I will be receiving tons of project files, and if the process is automated the users will then be able to instantly see results.

Basically, is there any way to create or run an automated process that will save these project files as .csv files? Even if the csv files are not formatted correctly, I can find a way around that, just need to first get them into .csv files.

Thank you.

edit - the only way i could think of this is to follow the instructions listed below, but I would then need to automate a process to open the file and hit save so this works... any other suggestions?

http://social.technet.microsoft.com/Forums/en-US/projectprofessional2010general/thread/eea4ca15-0a0b-4c07-9989-87536b961385/

edit 2 - also looking into ways using Microsoft.Office.Interop.MSProject but not finding any luck.

edit 3 0 now using mpxj - the only issue I am having is the following listed below. Converting their example to vb.

Private Shared Function ToEnumerable(ByVal javaCollection As Collection) As EnumerableCollection
        Return New EnumerableCollection(javaCollection)
    End Function

the error is with EnumberableCollection - visual studio is not picking it up as a valid type - anything I am doing wrong or should substitute?

njj56
  • 611
  • 4
  • 19
  • 51
  • The EnumerableCollection class is not a part of the normal mpxj library. You will need to create a vb version of the EnumerableCollection class in your vb project. So add an EnumerableCollection.vb file to your project and then convert/copy the code from the cs file into it. – patmortech Mar 14 '12 at 03:41

1 Answers1

1

If you aren't wedded to using MS Project itself to extract data from the project files, you could consider using the MPXJ library. This would allow you to write a simple utility to open the MPP files you are given, extract the data items you are interested in, and write them directly to your database (or an intermediate CSV file, as required). MPXJ comes in Java and .Net flavours, so you can use your preferred language to do the work.

Jon

p.s. Disclaimer: I maintain MPXJ

Jon Iles
  • 2,519
  • 1
  • 20
  • 30
  • I have been playing around with MPXJ to try to do this. do you know of any good .net examples posted online? This would be really helpful to explain the process to my team as well. Thanks. – njj56 Mar 13 '12 at 13:18
  • In the MPXJ distribution you'll find a src.net folder which contains some simple examples of how to use the API. The MpxjQuery sample is probably most relevant to you. I'm trying to improve the documentation and samples, so if there is something particular you need which isn't covered, let me know and I'll put some code together for you. – Jon Iles Mar 13 '12 at 14:00
  • I see all the examples are in c# - are there any vb examples floating around? – njj56 Mar 13 '12 at 14:24
  • Not at the moment, although I could probably dust off my VB.net and produce something! The mechanics of using the API won't really vary between the languages though. – Jon Iles Mar 13 '12 at 14:31
  • Thanks, Specifically I am looking for a vb way to read the file, I can convert the rest myself but am having some trouble just reading at first. – njj56 Mar 13 '12 at 14:41
  • I think i was able to convert enough of it, I will let you know of any issues. Thanks again for your quick help – njj56 Mar 13 '12 at 15:09
  • only issues i am running into is with the following sub Private Shared Function ToEnumerable(ByVal javaCollection As Collection) As EnumerableCollection Return New EnumerableCollection(javaCollection) End Function looks like enumberablecollection isnt a valid type - is there something for vb to replace this with or am i doing something wrong? - just noticed it doesnt format smooth, but conversion of the origional from the query example. – njj56 Mar 13 '12 at 16:07
  • EnumerableCollection is a class which is provided alongside the sample MpxjQuery.cs code in the distribution. It just provides a simple method of mapping from the Java collection types to a form which is easy to use from a .Net language. – Jon Iles Mar 13 '12 at 22:03
  • The API documentation is here: http://mpxj.sourceforge.net/apidocs/index.html, for the Task object specifically, the documentation is here: http://mpxj.sourceforge.net/apidocs/net/sf/mpxj/Task.html. – Jon Iles Mar 14 '12 at 13:23