none
Project Pro 2013 - application.mapedit + application.fileopenex RRS feed

  • Question

  • Hi there

    We have developed an application for ms project pro. We deal with large amount of data and we found a method that could help us write on the MS Project Pro 2013. It is the application.mapedit + fileopenex. It works really fine when your data is in a MS Excel Spreadsheet (see example below), however I could not find a way to read the information from a data source, like a mdf file and write on MS Project. The msdn documentation says the following: 

    "The Name parameter can contain a file name string or an ODBC data source name (DSN) and project name string. The syntax for a data source is <DataSourceName>\Projectname. The less than (<) and greater than (>) symbols must be included, and a backslash ( \ ) must separate the data source name from the project name. DataSourceName itself can either be one of the ODBC data source names installed on the computer or a path and file name for a file-based database."


    My code example for ms excel is the following (it works fine)

    Globals.ThisAddIn.Application.FileOpenEx(Name: "C:\Users\user1\Documents\ExcelFile.xlsx",
    ReadOnly: false, Merge: PjMergeType.pjDoNotMerge, FormatID: "MSProject.ACE",Map: "Test",
    DoNotLoadFromEnterprise: true);


    when I try to repeat the code above for a mdf file it does not work

    Globals.ThisAddIn.Application.FileOpenEx(Name: "C:\Users\user1\Documents\file.mdf",
    ReadOnly: false, Merge: PjMergeType.pjDoNotMerge, FormatID: "MSProject.ODBC.11",Map: "Test",
    DoNotLoadFromEnterprise: true);

    The application install MS SQL Localdb and I have also tryed installing MS ODBC driver 13 for SQL, but it didn't work.
    We have also tried with FormatID: "MSProject.ODBC.13" for the drive above, but it didn't work either.

    I would be very greatfull for any help received.

    Thanks





    PL

    Thursday, August 11, 2016 8:49 PM

All replies

  • I've never tried this before but you're using a path name to the file in the second example. Try setting up an ODBC data source via the Control Panel and using that.
    Friday, August 12, 2016 1:25 PM
  • Hi Bill

    Thanks for your suggestion, it is not for my personal use. We have many ms project clients and I would have to set this manually for every installation on the client and that's the reason why we decided not to try. Besides, the work configuring this would be very intense and it would always depend on the user.

    Thanks

    Pedro


    PL

    Monday, August 15, 2016 2:27 PM
  • You can't just open a database file like that. You have to do it through ODBC or some other database access method. Are your clients all opening on a local instance of SQL Server or is the server on a network?
    Monday, August 15, 2016 2:47 PM
  • Hi Bill, thanks for your email.

    We have tried using the standard SQL connection string and we have also tried installing MS ODBC driver 13 for SQL and we could not succeed.

    The thing is that the documentation states the following:

    "The Name parameter can contain a file name string or an ODBC data source name (DSN) and project name string. The syntax for a data source is <DataSourceName>\Projectname. The less than (<) and greater than (>) symbols must be included, and a backslash ( \ ) must separate the data source name from the project name. DataSourceName itself can either be one of the ODBC data source names installed on the computer or a path and file name for a file-based database."

    So we tried both ways, but gaves me the following error "The argument value is not valid."

    Thanks.


    PL

    Monday, August 15, 2016 3:23 PM