none
Open enterpise projects using c# code. RRS feed

  • Question

  • Hi,

         I'm having problem in openning .mpp file [enterprise project] using C#, the following is the code I'm using to open a file

                    Process p = new Process();
                    p.StartInfo.FileName = "WINPROJ";
                    p.StartInfo.Arguments = "/s http://servername/PWA/Bob cost Value test0524.mpp"; //@"C:\temp\test.mpp";
                    p.Start();

     I can open a local file which is good, but the issue is with openning the enterprise project. The result of the above code, just open the new project but not the specific project.

    Could anyone please help me in resolving this issue.

    Thanks

    -Bob 

    Monday, June 13, 2011 3:07 PM

All replies

  • Have you looked into the MSDN Project Server 2010 SDK for examples with opening projects using C#

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

    Cheers!


    Michael Wharton, MBA, PMP, MCT, MCSD, MCSE+I, MCDBA
    www.WhartonComputer.com
    Monday, June 13, 2011 8:59 PM
    Moderator
  • I have to open the enterprise projects with MS Project using custom ASP.net [either C# or Vb.net] page (button click) as it opens from Project Center.
    Tuesday, June 14, 2011 12:52 AM
  • add a reference to  Microsoft.Office.Interop.MSProject to your VS project, then try this:

                Process p = new Process();

                p.StartInfo.FileName = "WINPROJ";

                p.Start();

                Microsoft.Office.Interop.MSProject.Application objAppProject;

                string filename = @"<>\projectname"; //don't put .mpp at the end

                objAppProject = new Microsoft.Office.Interop.MSProject.Application();

                objAppProject.FileOpenEx(filename); 

     

    Tuesday, June 14, 2011 1:07 AM
  • Thanks Andrei, the code work fantasitc.
    Thursday, June 16, 2011 1:53 AM
  • Hi Andrei,

     The Code is working fine on local debug mode and if I add the code to the website (on the server- ASP.net site) it's not working and I'm getting the following exception, Could you please help me on this.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.Runtime.InteropServices.COMException: Retrieving the COM class factory for component with CLSID {36D27C48-A1E8-11D3-BA55-00C04F72F325} failed due to the following error: 80010001.

    Source Error:

    Line 106:        string filename = @"<>\Bobs_Test_Project"; //don't put .mpp at the end
    Line 107:
    Line 108:        objAppProject = new MSPClient.Application();
    Line 109:
    Line 110:        objAppProject.FileOpenEx(filename, true, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, MSPClient.PjPoolOpen.pjPoolReadOnly, Type.Missing, Type.Missing,


    Source File: c:\inetpub\wwwroot\DEV_PS_MOPS_INTEGRATION\Default2.aspx.cs    Line: 108

    Thanks

    -Bob

    Server Error in '/' Application.

    Retrieving the COM class factory for component with CLSID {36D27C48-A1E8-11D3-BA55-00C04F72F325} failed due to the following error: 80010001.

     

    Thursday, June 16, 2011 3:24 AM