1

what I am trying to do is I have a label and MouseLeftButtonDown Event on it when the user click on the label it open the outlook application but whenever click again it run into an Exception here is the code that I have `

if (e.LeftButton == MouseButtonState.Pressed)
{
    Microsoft.Office.Interop.Outlook.Application objOutlook = new Microsoft.Office.Interop.Outlook.Application();
    Microsoft.Office.Interop.Outlook.MailItem mic = objOutlook.CreateItem (Microsoft.Office.Interop.Outlook.OlItemType.olMailItem) as Microsoft.Office.Interop.Outlook.MailItem;
    mic.To = "someone@live.com";
    mic.Subject = "l";
    mic.Body = "h";
    mic.Display(true);
}

and here is the Exception that I got ![Com Exception][1]

[1]:

Nic Wortel
  • 11,155
  • 6
  • 60
  • 79
Dexter90
  • 69
  • 2
  • 14
  • I put it as someone@live.com for privacy but, when I need to run the program I change it back to my support E-mail – Dexter90 Sep 30 '14 at 06:16
  • Google for "outlook interop rpc_e_call_rejected" gives many results, e.g. [this](http://blogs.msdn.com/b/akashb/archive/2008/11/03/unable-to-instantiate-outlook-object-from-visual-studio-2008-on-vista-with-uac-on.aspx). What have you tried? – cremor Sep 30 '14 at 07:03
  • Are you running Visual Studio as Administrator? – Andres Ramos Sep 30 '14 at 07:07
  • How about `Process.Start(FilePathTo + "OUTLOOK.EXE");`? – Sheridan Sep 30 '14 at 08:16

1 Answers1

3

How about that

var url = "mailto:foo@bar.com?subject=Test&body=Hello";
System.Diagnostics.Process.Start(url);
coder0815
  • 219
  • 2
  • 8