none
Unable to cast COM object of type 'Microsoft.Office.Interop.Outlook.NameSpaceClass' to interface type 'Microsoft.Office.Interop.Outlook._NameSpace'. RRS feed

  • Question

  • Unable to cast COM object of type 'Microsoft.Office.Interop.Outlook.NameSpaceClass' to interface type 'Microsoft.Office.Interop.Outlook._NameSpace'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{00063002-0000-0000-C000-000000000046}' failed due to the following error: Error loading type library/DLL. (Exception from HRESULT: 0x80029C4A (TYPE_E_CANTLOADLIBRARY)).

    at Microsoft.Office.Interop.Outlook.NameSpaceClass.GetDefaultFolder(OlDefaultFolders FolderType)

    Please help me!

    Wednesday, February 15, 2012 9:08 AM

Answers

  • I do not hope for much improvement, but try this:

    Namespace session = Application.Session;

    session.GetDefaultFolder ...//etc.

    Wednesday, February 15, 2012 11:22 AM

All replies

  • write somethng about background (which office version, which .net version, add-in developed with which VS) and show more or code that causes trouble.
    Wednesday, February 15, 2012 9:42 AM
  • User's PC:

    OS: Microsoft Windows NT 6.1.7601 Service Pack 1;

    CPU: AMD64;

    Office: 2007, 32bit;

    Net Framework: 3.5 or later;

    Developer's PC:

    IDE: VS 2008 Version 9.0.21022.8 RTM

    It's ok that the software is ran in many PCs, but only this one is failed, and throw the exception message.

    Wednesday, February 15, 2012 10:27 AM
  • Is PIA deployed on that machine?

    Wednesday, February 15, 2012 10:36 AM
  • Yes, PIA is installed.

    Add-in is launched successfully, and I coded these:

    Microsoft.Office.Interop.Outlook.NameSpace nameSpace = Application.GetNamespace("MAPI");

    nameSpace.GetDefaultFolder(OlDefaultFolders.olFolderCalendar);   // this code throw the exception

    Wednesday, February 15, 2012 11:04 AM
  • I do not hope for much improvement, but try this:

    Namespace session = Application.Session;

    session.GetDefaultFolder ...//etc.

    Wednesday, February 15, 2012 11:22 AM