COM Collections

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jeff

    #1

    COM Collections

    I'm getting an error:

    Unable to cast COM object of type 'System.__ComOb ject' to interface
    type 'Microsoft.Offi ce.Interop.MSPr oject.Task'. This operation failed
    because the QueryInterface call on the COM component for the interface
    with IID '{000C0C3F-0000-0000-C000-000000000046}' failed due to the
    following error: Error loading type library/DLL. (Exception from
    HRESULT: 0x80029C4A (TYPE_E_CANTLOA DLIBRARY)).

    when I try to execute the following code:

    object oAP = objProj.ActiveP roject;
    object prjTasks =
    objProj.ActiveP roject.GetType( ).InvokeMember( "Tasks",
    BindingFlags.De claredOnly |
    BindingFlags.Pu blic | BindingFlags.No nPublic |
    BindingFlags.In stance | BindingFlags.In vokeMethod, null,oAP,null);

    foreach (msPrj.Task prjTask in (IEnumerable)pr jTasks)
    {
    msPrj.Task myTask = (msPrj.Task) prjTask;
    if ((bool)myTask.S ummary == false &&
    (int)myTask.Dur ation != 0)
    myTask.Duration = (int)myTask.Dur ation *
    ScalePercent;
    }

    I'm trying to loop thru a collection of Microsoft Project Tasks. The
    strange thing is it works when I run it in VS2005. However when it's
    run thru IIS it throws the error above.

    Anyone seen this, or have any idea?

    Thanks

Working...