C# 2 .NET 2 and Outlook automation

1 view
Skip to first unread message


Apr 11, 2006, 1:40:45 PM4/11/06
I'm trying to use a C# program to read the Outlook Sent Items folder.
The constructor:

Outlook.Application oApp = new Outlook.Application ();

throws exception:

System.IO.FileNotFoundException: Retrieving the COM class factory for
with CLSID {0006F03A-0000-0000-C000-000000000046} failed due to the
following er
ror: 8007007e.

A little Googling told me that 8007007e is some sort of general Windows
resource error. For other apps advice to reregister the DLL has been
given. But as far as I can tell
doesn't have a DLLRegisterServer entry point.

This used to work on .NET 1 but when I went to .NET 2 and Visual C#
2005 I saw the exception.

I also have code to automate Excel which works OK in the new

How to I get the Outlook constructor to succeed?

Visual C# 2005 Express, .NET 2, and Outlook 2003.


Apr 16, 2006, 10:08:10 AM4/16/06
I'm getting the exact same thing! I tried uninstalling VS 2005 Tools
for Office and reinstalling PIA's for Office 2003, with no effect.

I can recreate it easily in both VS 2003 and VS 2005.

1) Creat a Windows Form app, add a button to the form.
2) Add the COM reference of Microsoft Outlook 11 Object Library. This
adds two references in my application.

1 - Microsoft.Office.Interop.Outlook,

2- Microsoft Office 11.0 Object Library, {\}\2.3\0\primary,
C:\WINDOWS\assembly\GAC\Office\\Office.dll, ( I Can remove this reference and it doesn't make a
difference. I still get the error.

3) Add this code to the form and attach click event to button.

using OL = Microsoft.Office.Interop.Outlook;

private void button1_Click(object sender, EventArgs e) {
try {
OL.Application app = new OL.ApplicationClass();

OL.MailItem mail =
as OL.MailItem;
} catch(Exception ex) {

When I run and try to create the MailItem, I get this error. I also
get it on machines that don't have Visual Studio installed on it,
although I include my copy of Microsoft.Office.Interop.Outlook.dll in
the application path.

System.IO.FileNotFoundException: Retrieving the COM class factory for
component with CLSID {0006F03A-0000-0000-C000-000000000046} failed due
to the following error: 8007007e.

at OutlookTest.Form1.button1_Click(Object sender, EventArgs e) in
\OutlookTest\Form1.cs:line 18The thread '<No Name>' (0x25d8) has exited
with code 0 (0x0).

Any help would be greatly appreciated!!


Apr 16, 2006, 11:30:35 AM4/16/06
I found the problem on my machine; damn Symantec ScriptBlocker registry
entry was not removed when I unistalled Symantec Antivirus/Firewall a
while ago. I still need to look into why it was occuring on other

See the registry entry below. Reinstalling Office 2003 or Repairing it
did not change it, so I ended up deleting it completely. I assume I
was getting the FileNotFound Exception because "C:\\Program
Files\\Common Files\\Symantec Shared\\Script Blocking\\ScrBlock.dll"
doesn't exist anymore on my machine.

(One more reason to use quality Registry cleaners..)

@="Microsoft Office Outlook"


@="C:\\Program Files\\Common Files\\Symantec Shared\\Script
"Assembly"="Microsoft.Office.Interop.Outlook, Version=,
Culture=neutral, PublicKeyToken=71e9bce111e9429c"

"Assembly"="Microsoft.Office.Interop.Outlook, Version=,
Culture=neutral, PublicKeyToken=71e9bce111e9429c"







Reply all
Reply to author
0 new messages