Outlook object model 11, error 0x80080005 when outlook already run

A

albattran

Hi everyone,
When trying to send to use the outlook COM interop assembly from a fully
trusted xbap, I get 0x80080005 error if outlook is already running. If
outlook was not running, it opens up the send mail dialog just fine.

Here is what I am using to reproduce this problem:
Microsoft.Office.Interop.Outlook.Application objOutlook = new
Microsoft.Office.Interop.Outlook.ApplicationClass();
Microsoft.Office.Interop.Outlook.MailItem mailItem =
(Microsoft.Office.Interop.Outlook.MailItem)objOutlook.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem);
mailItem.Subject = "test";
mailItem.Body = "b";
mailItem.Attachments.Add(@"c:\test.bmp",
System.Reflection.Missing.Value, System.Reflection.Missing.Value,
System.Reflection.Missing.Value);
mailItem.Display(false);

And the error is this:
System.Runtime.InteropServices.COMException (0x80080005): Retrieving the COM
class factory for component with CLSID {0006F03A-0000-0000-C000-000000000046}
failed due to the following error: 80080005.


Keep in mind, that the above code works fine if I run from a regular windows
forms app. The same behavior exists for v10.

Any workarounds are greatly appreciated.
Thanks,
Samir
 

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