从WPF应用程序打开Outlook
本文关键字:Outlook 应用程序 WPF | 更新日期: 2023-09-27 18:25:11
我要做的是,我有一个标签和MouseLeftButtonDown事件,当用户单击标签时,它会打开outlook应用程序,但每当再次单击时,它都会遇到异常这是我的代码`
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);
}
这是我得到的例外![Com异常][1]
[1] :
怎么样
var url = "mailto:foo@bar.com?subject=Test&body=Hello";
System.Diagnostics.Process.Start(url);