Error while creating Outlook-Application-Object on OL2003/Vista?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi. I'm just trying to connect to Outlook 2003 from my C#-Application on
Vista. I added "Microsoft Outlook 11.0 Object Library" to the references of
my object, and then I'm calling:

using Outlook = Microsoft.Office.Interop.Outlook;
....
[STAThread]
static void Main(string[] args)
{
Outlook.Application application = new Outlook.Application();
}

Thats all. It works, when Outlook has not been started, but with Outlook
running, I get the error: Retrieving the COM class factory for component with
CLSID {0006F03A-0000-0000-C000-000000000046} failed due to the following
error: 80080005.

I installed the PIAs, and I checked that my references point to
\Windows\Assembly\GAC\.

Any ideas about that?
 
I've seen that only a couple of times and each time it was related to an
Outlook COM addin that was doing something that prevented starting Outlook
that way from a standalone program when Outlook was already running.

What Outlook COM addins are running that might present a problem? Disable
all addins and see if your code works then. If so then re-enable the addins
one at a time until you find the culprit.

I've seen it happen with a Skype addin (the developer is aware of the
problem and looking at it with some test code I sent him) and the Plaxo
Outlook addin, which causes all sorts of other problems too.

The odd thing is that in the situations I've seen similar code works just
fine when run using VBA, such as simple automation in Word or Excel VBA to
start Outlook. So it's a mix in those cases of something an addin was doing
plus the COM Interop.
 
I've seen that only a couple of times and each time it was related to an
Outlook COM addin that was doing something that prevented starting Outlook
that way from a standalone program when Outlook was already running.
Thanks for your reply. I run skype, but there seems no add-in in outlook
from skype.

I only found one add-in ("properties-pages of the exchange-extension"), but
disabling it wouldn't help unfortunatly...

Any other ideas?
 
That's an Exchange extension and not a COM addin. Check in the registry at
\Software\Microsoft\Office\Outlook\Addins in both HKCU and HKLM to see what
addins are installed.

Other than that I have no ideas.
 
That's an Exchange extension and not a COM addin. Check in the registry at
\Software\Microsoft\Office\Outlook\Addins in both HKCU and HKLM to see what
addins are installed.
Ah okay. I got 5 Addins there (BlueTooth, Anti-Virus, Microsoft-VbaAddin,
OAddin(?), Search.OutlookToolbar). How can I disable them to do a test?
 
The VBA one is almost never a problem, but to disable them set LoadBehavior
to 2 from 3. Do that while Outlook isn't running. The addins won't start and
if the problem goes away you can then re-enable the addins one at a time by
setting LoadBehavior back to 3 and starting Outlook until you find the
problem addin. Offhand I'd suggest trying with Bluetooth, the AV addin and
OAddin.
 
Hi Ken,

I found the time to do some more tests: The problem is not an AddIn, it's
the user access control of Vista! I can disable all AddIns, but it still
doesn't work with UAC enabled. I can enable all AddIns, but disable UAC, and
it works.

Is this ment "by design", which means: There is no way to connect to Outlook
with UAC enabled?
 
In that case you might need to request an elevation of privileges in your
code before you try to create the application object. That I have no idea
about, you might want to check in a Vista development forum on how to do
that.
 
Back
Top