Skip to content

Throwing exception when reading mpp files

Madhu Sudhan

Asked Oct 10, 2013, 12:44 AM EDT1 answer
Share
LinkedInX
Hii,

I am trying to read Microsoft project plan files using c#.But when i try to read the .mpp file its throwing exception "Retrieving the COM class factory for component with CLSID {36D27C48-A1E8-11D3-BA55-00C04F72F325} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))." 

My code is 

  ApplicationClass projectApp = new ApplicationClass();

    // Open the file. There are a number of options in this constructor as you can see
            projectApp.FileOpen("c:\\Users\\madhu.sudhang\\b4ubuild_sample_07.mpp", true, Missing.Value, Missing.Value, Missing.Value,
    Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value,
Java
    PjPoolOpen.pjDoNotOpenPool, Missing.Value, Missing.Value, Missing.Value, Missing.Value);


    // Get the active project
    Project proj = projectApp.ActiveProject;


    // Enumerate the tasks
    foreach (Task task in proj.Tasks)
    {
    string name = task.Name;


    // Project stores the number of minutes in a workday, so 8 hours per workday * 60 = 480. 480 is a project "day"
    int duration_in_days = Int32.Parse(task.Duration.ToString()) / 480;


    DateTime start = DateTime.Parse(task.Start.ToString());
    DateTime finish = DateTime.Parse(task.Finish.ToString());
    double percent_complete = Double.Parse(task.PercentComplete.ToString());
    DateTime actual_finish = DateTime.Parse(task.ActualFinish.ToString());


    // Do something with each task here
      }


    // Make sure to clean up and close the file
    projectApp.FileCloseAll(PjSaveType.pjDoNotSave)

i kept break point and observed when creating  Application class object its throwing the exception.

Plz help me out of this.

Thanks & Regards

Madhu Sudhan

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • 0
    Hi,

    I use Aspose.Tasks for .NET Component for creating my MS project files, you can also read MS Project files with this component. Try it i hope it will solve your problem.
    0