Outlook.ApplicationClass.CreateItem: "The operation failed."

B

Bruce Wood

I have a problem that is driving us bonkers here. We've tried any
number of workarounds and haven't been able to find a solution.

I've written a specialized print preview dialog that allows the user to
e-mail a report by choosing a menu item. Because I want the user to
fill in the destination name and e-mail subject, I call Outlook and pop
a message dialog. To do this, I call the
Outlook.ApplicationClass.CreateItem method that takes an OlItemType,
which I pass as MailItem.

This works for almost all users. However, for _some_ users, it fails
with a message:

System.Runtime.InteropService.COMException (0x841300003): The operation
failed.
at Outlook.ApplicationClass.CreateItem

These users report the failure as consistent: they say that they can
_never_ e-mail a report. It _always_ fails with this message. Other
users use the feature with no problems. I've tried everything I know to
even find out why this problem occurs for some people and not others.
We can't see the pattern, and none of my shot-in-the-dark attempts have
worked.

My app is written in C#, but I've seen the same error message cropping
up from time to time in this newsgroup, and you guys are the Outlook
gurus, so I figured I'd ask here. So far we've tried changing the
version of Outlook we call through the interop (didn't help). We also
tried catching the exception, waiting a few seconds, and then retrying.
That didn't help, either.

Our app is running on Citrix running Windows Server 2003. Both the RTM
and SP1 versions have the same problem. We are running Office 2003 SP2
with all hotfixes installed.
 
S

Sue Mosher [MVP-Outlook]

If you get an error from a CreateObject("Outlook.Application") code statement, the cause may be an anti-virus program on your computer that has a feature to block Outlook scripting. The solution is to turn off the script blocking feature.

If you're using Symantec Anti Virus, make a backup of the Windows registry, and then see if these changes solve the problem:

1. Go to the HKEY_CLASSES_ROOT\Outlook.Application\CLSID key and note the (Default) value. It will be a GUID, most likely {0006F03A-0000-0000-C000-000000000046}.

2. Now go to the key HKEY_CLASSES_ROOT\CLSID\{0006F03A-0000-0000-C000-000000000046}\InprocServer32 key, using the value from Step 1 if it's different from that shown above.

3. For the (Default) for that key, you should see this value:

C:\Program Files\Common Files\Symantec Shared\Script Blocking\ScrBlock.dll

Delete that text, so that the key's (Default) value becomes (value not set)

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
B

Bruce Wood

Thanks for the tip. Unfortunately, we're using Sophos, not Symantec,
and according to our admin guy, "Sophos doesn't do that." He checked
out the relevant registry keys, and they are still set to the
defaults... no evidence of script blocking.

We're going to escalate this to Microsoft. I just figured I'd post to
thank you (and see if you had any other ideas. :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top