locked
UNABLE TO OPEN PROJECT USING MSPROJECT OBJECT RRS feed

  • Question

  • Hello Everyone,

    I am new to MSProject and i ran to a problem, the problem is that i am unable to open the project using  FileOpenEx method i initialized the MSProject.Application object and then i tried to open the file which stored is stored in project server but it throws an exception The server threw an exception. (Exception from HRESULT: 0x80010105 (RPC_E_SERVERFAULT)). This is how i passed the parameters:

    METHOD 1:

    using MPP = Microsoft.Office.Interop.MSProject;

    MPP.Application mspApp = new MPP.Application();


    mspApp.FileOpenEx(@"<>\" + (cmbProjects.Text), false, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, "username", "password",Type.Missing, Type.Missing, MPP.PjPoolOpen.pjPoolReadWrite, Type.Missing, Type.Missing, Type.Missing, Type.Missing,false);


     METHOD 2:

    I created odbc DSN using Data Sources (ODBC) from administrative tools

    mspApp.FileOpenEx(@"<MSProject>\" + (cmbProjects.Text), false, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, "username", "password",Type.Missing, Type.Missing, MPP.PjPoolOpen.pjPoolReadWrite, Type.Missing, Type.Missing, Type.Missing, Type.Missing,false);

    METHOD 3:

    ProcessStartInfo procSI = new ProcessStartInfo("WINPROJ.EXE");

    procSI.WindowStyle = ProcessWindowStyle.Hidden;

    Process.Start(procSI);

    System.Threading.Thread.Sleep(10000);

    mspApp.FileOpenEx(@"<>\" + (cmbProjects.Text), false, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, "username", "password",Type.Missing, Type.Missing, MPP.PjPoolOpen.pjPoolReadWrite, Type.Missing, Type.Missing, Type.Missing, Type.Missing,false);

    First two methods are not working at all but the third is working fine but the problem is i don't want ms project application to be shown to user. Once the user selects the project from combo box it should open in the background and should be available for later usage.

    Is there anything that i can do about this?

    Thanks & Regards,

    abhinaxis

    Thursday, September 2, 2010 12:21 PM

Answers