ms project 2007

A

Andy

A simple call to load up proj 2007 ends up in a COM Exception: Creating an
instance of the COM component with CLSID
{36D27C48-A1E8-11D3-BA55-00C04F72F325} from the IClassFactory failed due to
the following error: 80010001. Here's the code being used:

using MSProject = Microsoft.Office.Interop.MSProject;

public void LoadProject(string fileName)
{
MSProject.ApplicationClass app = null;

try
{
// execute the Microsoft Project Application
app = new MSProject.ApplicationClass();
}
catch (System.Runtime.InteropServices.COMException ex)
{
//Get COM exception here:
retVal = "Could not process the MS Project file " + fileName
+ "." + System.Environment.NewLine + ex.Message + System.Environment.NewLine
+ ex.StackTrace;
}
}

I have tried to decorate the method with
[PermissionSetAttribute(SecurityAction.Demand, Name = "FullTrust")], and that
gets the same error. I have also tried to update the security for Microsoft
project (by adding the domain account).

Any thoughts or suggestions would be appreciated.
 
M

Maik

Hello Andy,

try smth like this

using System;
using System.Diagnostics;
using System.Reflection;
using Microsoft.Office.Interop.MSProject;


class Program
{
static Application app;
static string projectServerUrl = "http://YourServerName/PWAInstance";
static string pathToWinProjExe = @"C:\Program Files\Microsoft
Office\Office12\WINPROJ.EXE";
static void Main(string[] args)
{
string param = " /s " + projectServerUrl;
Process.Start(pathToWinProjExe, param);

// maybe you´ve to wait some seconds for the connection and
project shows up in window...

app = new ApplicationClass();

if (app.ActiveProject.ServerURL == projectServerUrl)
{ // use your own paramlist,
app.FileOpenEx(@"<>\YourProjectNameHere", false,
Missing.Value, Missing.Value, Missing.Value, Missing.Value,
Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value,
PjPoolOpen.pjDoNotOpenPool, Missing.Value, Missing.Value, true,
Missing.Value, true);
// do smth
//...
app.FileCloseEx(PjSaveType.pjSave, (object)true,
(object)true);
//...
app.Quit(PjSaveType.pjDoNotSave);
app = null;
}
}
}

Greets
Maik
 
G

Greg Frazier

Andy,

This error is occurring on my app running overseas. Did you get this
problem resolved? Is so, please post the code snippet of the solution.

Thanks.

Greg
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top