A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Add-ins for Outlook
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

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



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old June 16th 08, 07:38 PM posted to microsoft.public.outlook.program_addins
John Yovas
external usenet poster
 
Posts: 1
Default Unable to cast object of type 'System.__ComObject' to type 'Microsoft.Office.Interop.Outlook.ApplicationClass '

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)Acti vator.CreateInstance(oType);



Unable to cast object of type 'System.__ComObject' to type
'Microsoft.Office.Interop.Outlook.ApplicationClass '.
at
System.Runtime.Remoting.RemotingServices.AllocateU ninitializedObject(RuntimeType
objectType)
at
System.Runtime.Remoting.RemotingServices.AllocateU ninitializedObject(Type
objectType)
at
System.Runtime.Remoting.Activation.ActivationServi ces.CreateInstance(Type
serverType)
at
System.Runtime.Remoting.Activation.ActivationServi ces.IsCurrentContextOK(Type
serverType, Object[] props, Boolean bNewObj)
at System.RuntimeTypeHandle.CreateInstance(RuntimeTyp e 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


Ads
  #2  
Old June 16th 08, 10:26 PM posted to microsoft.public.outlook.program_addins
Dmitry Streblechenko
external usenet poster
 
Posts: 2,116
Default Unable to cast object of type 'System.__ComObject' to type 'Microsoft.Office.Interop.Outlook.ApplicationClass '

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" wrote in message
...
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)Acti vator.CreateInstance(oType);



Unable to cast object of type 'System.__ComObject' to type
'Microsoft.Office.Interop.Outlook.ApplicationClass '.
at
System.Runtime.Remoting.RemotingServices.AllocateU ninitializedObject(RuntimeType
objectType)
at
System.Runtime.Remoting.RemotingServices.AllocateU ninitializedObject(Type
objectType)
at
System.Runtime.Remoting.Activation.ActivationServi ces.CreateInstance(Type
serverType)
at
System.Runtime.Remoting.Activation.ActivationServi ces.IsCurrentContextOK(Type
serverType, Object[] props, Boolean bNewObj)
at System.RuntimeTypeHandle.CreateInstance(RuntimeTyp e 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



  #3  
Old September 12th 08, 04:23 PM posted to microsoft.public.outlook.program_addins
hops10
external usenet poster
 
Posts: 1
Default Unable to cast object of type 'System.__ComObject' to type 'Micros

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)Acti vator.CreateInstance(oType);



Unable to cast object of type 'System.__ComObject' to type
'Microsoft.Office.Interop.Outlook.ApplicationClass '.
at
System.Runtime.Remoting.RemotingServices.AllocateU ninitializedObject(RuntimeType
objectType)
at
System.Runtime.Remoting.RemotingServices.AllocateU ninitializedObject(Type
objectType)
at
System.Runtime.Remoting.Activation.ActivationServi ces.CreateInstance(Type
serverType)
at
System.Runtime.Remoting.Activation.ActivationServi ces.IsCurrentContextOK(Type
serverType, Object[] props, Boolean bNewObj)
at System.RuntimeTypeHandle.CreateInstance(RuntimeTyp e 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



 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Access object in explorer from type olExplorer Christian Havel Add-ins for Outlook 3 October 19th 07 06:56 PM
Unable to cast COM object of type 'System.__ComObject' to interface type 'Microsoft.Office.Interop.Outlook.ContactItem'. Dhananjay Outlook and VBA 3 October 13th 07 07:56 AM
Which services sends SYSTEM type messags Mr. Smith Outlook - General Queries 0 November 17th 06 12:14 PM
Type of object for AdvancedSearch Renjith Outlook and VBA 4 May 17th 06 02:13 PM
Move object type Bob Smith Outlook and VBA 1 May 16th 06 07:08 AM


All times are GMT +1. The time now is 08:57 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright 2004-2025 Outlook Banter.
The comments are property of their posters.