Kulvinder

Hi,

I am using Outlook 2003 professional and getting the "MAPI" Namespace reference using :

Microsoft.Office.Tools.Outlook.Application.GetNamespace(String Type)

The exception which i am getting is :

Unable to cast COM object of type 'System.__ComObject' to interface type 'Microsoft.Office.Interop.Outlook._Application'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{00063001-0000-0000-C000-000000000046}'

failed due to the following error: Library not registered. (Exception from HRESULT: 0x8002801D (TYPE_E_LIBNOTREGISTERED)).

Source : Microsoft.Office.Interop.Outlook

Any idea why




Re: Visual Studio Tools for Office Unable to cast COM object of type 'System.__ComObject' to interface type 'Microsoft.Office.Interop.Outlook._Application'

Kulvinder

I am using the above code in a VSTO SE Addin on a client's machine




Re: Visual Studio Tools for Office Unable to cast COM object of type 'System.__ComObject' to interface type 'Microsoft.Office.Interop.Outlook._Application'

Sue Mosher - Outlook MVP

Has the client installed the Office 2003 PIAs



Re: Visual Studio Tools for Office Unable to cast COM object of type 'System.__ComObject' to interface type 'Microsoft.Office.Interop.Outlook._Application'

Andrew Melim

I am having a similar issue with a Powerpoint 2003 add-in which creates a custom command bar. I am running VS 2005 and VSTO SE.

Unable to cast COM object of type 'System.__ComObject' to interface type 'Microsoft.Office.Core.CommandBarButton'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{000C030E-0000-0000-C000-000000000046}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).





Re: Visual Studio Tools for Office Unable to cast COM object of type 'System.__ComObject' to interface type 'Microsoft.Office.Interop.Outlook._Application'

Kulvinder

Yes,

The client has installed 2003 PIAs.






Re: Visual Studio Tools for Office Unable to cast COM object of type 'System.__ComObject' to interface type 'Microsoft.Office.Interop.Outlook._Application'

Sue Mosher - Outlook MVP

And this is a VSTO 2005 or VSTO 2005 SE application



Re: Visual Studio Tools for Office Unable to cast COM object of type 'System.__ComObject' to interface type 'Microsoft.Office.Interop.Outlook._Application'

Kulvinder

This is an application created with VSTO 2005 but the client has VSTOSE 2005 Runtime installed.




Re: Visual Studio Tools for Office Unable to cast COM object of type 'System.__ComObject' to interface type 'Microsoft.Office.Interop.Outlook._Application'

Andrew Cherry [MSFT]

The two look to be unrelated problems, but possibly with similar causes.

The former problem looks as if Outlook was not properly installed; "Repairing" Office setup may help.

The latter appears as if the object that's being returned is not a CommandBarButton; without seeing the syntax you're using to create the button, I can't begin to guess what's going wrong. I recommend opening a new thread just on that problem, in order to keep the two issues separate.

Thanks,

Andrew