C# 2 .NET 2 and Outlook automation

1 view
Skip to first unread message

toduro

unread,
Apr 11, 2006, 1:40:45 PM4/11/06
to
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
component
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
C:\WINDOWS\assembly\GAC\Microsoft.Office.Interop.Outlook\...\Microsoft.Office.Interop.Outlook.dll
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
environment.

How to I get the Outlook constructor to succeed?

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

acr...@gmail.com

unread,
Apr 16, 2006, 10:08:10 AM4/16/06
to
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,
{00062FFF-0000-0000-C000-000000000046}\9.2\0\primary,
C:\WINDOWS\assembly\GAC\Microsoft.Office.Interop.Outlook\11.0.0.0__71e9bce11,
9.2.0.0

2- Microsoft Office 11.0 Object Library, {\}\2.3\0\primary,
C:\WINDOWS\assembly\GAC\Office\11.0.0.0__71e9bce111e9429c\Office.dll,
2.3.0.0 ( 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 =
app.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem)
as OL.MailItem;
mail.Display(false);
} catch(Exception ex) {
System.Diagnostics.Debug.Write(ex.ToString());
}
}

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!!

acr...@gmail.com

unread,
Apr 16, 2006, 11:30:35 AM4/16/06
to
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
machines.

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..)

[HKEY_CLASSES_ROOT\CLSID\{0006F03A-0000-0000-C000-000000000046}]
@="Microsoft Office Outlook"

[HKEY_CLASSES_ROOT\CLSID\{0006F03A-0000-0000-C000-000000000046}\InprocHandler32]
@="ole32.dll"
"ThreadingModel"="Apartment"

[HKEY_CLASSES_ROOT\CLSID\{0006F03A-0000-0000-C000-000000000046}\InProcServer32]
@="C:\\Program Files\\Common Files\\Symantec Shared\\Script
Blocking\\ScrBlock.dll"
"Class"="Microsoft.Office.Interop.Outlook.ApplicationClass"
"RuntimeVersion"="v1.1.4322"
"Assembly"="Microsoft.Office.Interop.Outlook, Version=11.0.0.0,
Culture=neutral, PublicKeyToken=71e9bce111e9429c"

[HKEY_CLASSES_ROOT\CLSID\{0006F03A-0000-0000-C000-000000000046}\InProcServer32\11.0.0.0]
"Class"="Microsoft.Office.Interop.Outlook.ApplicationClass"
"RuntimeVersion"="v1.1.4322"
"Assembly"="Microsoft.Office.Interop.Outlook, Version=11.0.0.0,
Culture=neutral, PublicKeyToken=71e9bce111e9429c"

[HKEY_CLASSES_ROOT\CLSID\{0006F03A-0000-0000-C000-000000000046}\LocalServer32]
@="C:\\PROGRA~1\\MICROS~2\\OFFICE11\\OUTLOOK.EXE"
"LocalServer32"=hex(7):27,00,5d,00,67,00,41,00,56,00,6e,00,2d,00,7d,00,66,00,\

28,00,5a,00,58,00,66,00,65,00,41,00,52,00,36,00,2e,00,6a,00,69,00,4f,00,55,\

00,54,00,4c,00,4f,00,4f,00,4b,00,46,00,69,00,6c,00,65,00,73,00,3e,00,69,00,\

72,00,40,00,58,00,37,00,63,00,72,00,24,00,25,00,40,00,75,00,24,00,7d,00,26,\
00,56,00,37,00,7b,00,34,00,70,00,27,00,00,00,00,00

[HKEY_CLASSES_ROOT\CLSID\{0006F03A-0000-0000-C000-000000000046}\ProgID]
@="Outlook.Application.11"

[HKEY_CLASSES_ROOT\CLSID\{0006F03A-0000-0000-C000-000000000046}\Typelib]
@="{00062FFF-0000-0000-C000-000000000046}"

Reply all
Reply to author
Forward
0 new messages