PC Review


Reply
Thread Tools Rate Thread

Unable to cast object of type 'System.__ComObject' to type 'Microsoft.Office.Interop.Outlook.ApplicationClass'

 
 
John Yovas
Guest
Posts: n/a
 
      16th Jun 2008
We get this error only in one of our users PC with office 2003 we tried re
Reinstalling the Office 2003 Primary InterOp Assemblies also. Why should
this happen in only one users desktop when we have this add-in running on
100 of other workstation ?

Microsoft.Office.Interop.Outlook.Application oApplication = null;

try

{

comboBox_Folder.Items.Clear();

Type oType = Type.GetTypeFromProgID("Outlook.Application");

if (oType != null)

oApplication =
(Microsoft.Office.Interop.Outlook.Application)Activator.CreateInstance(oType);



Unable to cast object of type 'System.__ComObject' to type
'Microsoft.Office.Interop.Outlook.ApplicationClass'.
at
System.Runtime.Remoting.RemotingServices.AllocateUninitializedObject(RuntimeType
objectType)
at
System.Runtime.Remoting.RemotingServices.AllocateUninitializedObject(Type
objectType)
at
System.Runtime.Remoting.Activation.ActivationServices.CreateInstance(Type
serverType)
at
System.Runtime.Remoting.Activation.ActivationServices.IsCurrentContextOK(Type
serverType, Object[] props, Boolean bNewObj)
at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean
publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle&
ctor, Boolean& bNeedSecurityCheck)
at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean
fillCache)
at System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean
skipVisibilityChecks, Boolean fillCache)
at System.Activator.CreateInstance(Type type, Boolean nonPublic)

TIA
John


 
Reply With Quote
 
 
 
 
Dmitry Streblechenko
Guest
Posts: n/a
 
      16th Jun 2008
Why would you create an instance of the Outlook.Aplication object if you can
get it drectly from Outlook?
Besides being easier, that instance of the Outlook.Aplication object will
not be subject to the security prompts.

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"John Yovas" <john@ez-data_NOSPAM.com> wrote in message
news:OiVskB%(E-Mail Removed)...
> We get this error only in one of our users PC with office 2003 we tried re
> Reinstalling the Office 2003 Primary InterOp Assemblies also. Why should
> this happen in only one users desktop when we have this add-in running on
> 100 of other workstation ?
>
> Microsoft.Office.Interop.Outlook.Application oApplication = null;
>
> try
>
> {
>
> comboBox_Folder.Items.Clear();
>
> Type oType = Type.GetTypeFromProgID("Outlook.Application");
>
> if (oType != null)
>
> oApplication =
> (Microsoft.Office.Interop.Outlook.Application)Activator.CreateInstance(oType);
>
>
>
> Unable to cast object of type 'System.__ComObject' to type
> 'Microsoft.Office.Interop.Outlook.ApplicationClass'.
> at
> System.Runtime.Remoting.RemotingServices.AllocateUninitializedObject(RuntimeType
> objectType)
> at
> System.Runtime.Remoting.RemotingServices.AllocateUninitializedObject(Type
> objectType)
> at
> System.Runtime.Remoting.Activation.ActivationServices.CreateInstance(Type
> serverType)
> at
> System.Runtime.Remoting.Activation.ActivationServices.IsCurrentContextOK(Type
> serverType, Object[] props, Boolean bNewObj)
> at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean
> publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle&
> ctor, Boolean& bNeedSecurityCheck)
> at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean
> fillCache)
> at System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean
> skipVisibilityChecks, Boolean fillCache)
> at System.Activator.CreateInstance(Type type, Boolean nonPublic)
>
> TIA
> John
>



 
Reply With Quote
 
hops10
Guest
Posts: n/a
 
      12th Sep 2008
I was having the same problem. Only one user out of 20 users was not
working. I found out that my program was trying to use Microsoft Interop
Assembly 12 on his system when it was suppose to use Microsoft Interop
Assembly 11. We had installed the 2007 interop assemblies which came in the
office 2007 compatibility pack for opening Office 2007 files on his system.
So he had interop assembly version 11.0 and 12.0. Once I uninstalled the
Office 2007 PIA, the program worked again. This is a temporary fix for me
until I can program my software to use the right assembly (if it is
possible). Hope this works for you.

You can check out what versions of assemblies you have installed on that
system at “C:\WINDOWS\assembly” --> Microsoft.Office.Interop.Outlook


"John Yovas" wrote:

> We get this error only in one of our users PC with office 2003 we tried re
> Reinstalling the Office 2003 Primary InterOp Assemblies also. Why should
> this happen in only one users desktop when we have this add-in running on
> 100 of other workstation ?
>
> Microsoft.Office.Interop.Outlook.Application oApplication = null;
>
> try
>
> {
>
> comboBox_Folder.Items.Clear();
>
> Type oType = Type.GetTypeFromProgID("Outlook.Application");
>
> if (oType != null)
>
> oApplication =
> (Microsoft.Office.Interop.Outlook.Application)Activator.CreateInstance(oType);
>
>
>
> Unable to cast object of type 'System.__ComObject' to type
> 'Microsoft.Office.Interop.Outlook.ApplicationClass'.
> at
> System.Runtime.Remoting.RemotingServices.AllocateUninitializedObject(RuntimeType
> objectType)
> at
> System.Runtime.Remoting.RemotingServices.AllocateUninitializedObject(Type
> objectType)
> at
> System.Runtime.Remoting.Activation.ActivationServices.CreateInstance(Type
> serverType)
> at
> System.Runtime.Remoting.Activation.ActivationServices.IsCurrentContextOK(Type
> serverType, Object[] props, Boolean bNewObj)
> at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean
> publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle&
> ctor, Boolean& bNeedSecurityCheck)
> at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean
> fillCache)
> at System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean
> skipVisibilityChecks, Boolean fillCache)
> at System.Activator.CreateInstance(Type type, Boolean nonPublic)
>
> TIA
> John
>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Unable to cast COM object of type 'System.__ComObject' to interface type 'Microsoft.Office.Interop.Outlook.ContactItem'. Dhananjay Microsoft Outlook VBA Programming 3 13th Oct 2007 08:56 AM
RE: Unable to cast COM object of type 'System.__ComObject' to interfac =?Utf-8?B?U0c=?= Microsoft Dot NET 0 20th Jan 2006 03:27 PM
Unable to cast COM object of type 'System.__ComObject' =?Utf-8?B?U3RldmUgV2lsa2luc29u?= Microsoft Dot NET Framework 0 13th Jan 2006 02:40 PM
Unable to cast object of type System.__ComObject Tony Microsoft C# .NET 1 29th Oct 2004 03:58 PM
Can not cast from type System.__ComObject to type Outlook.ApplicationClass an new Outlook.Application Me Microsoft Dot NET Framework 0 19th Jun 2004 03:37 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:56 PM.