2013-12-16 40 views
0

我想从Javascript中调用Silver Light方法。 注册了一个方法,并尝试打开一个新的Outlook电子邮件。Silverlight中的[ScriptableMember]中打开Outlook电子邮件时出错

但我收到此错误:

Error: System.NotSupportedException: This operation is not supported in the current context. at System.Windows.Browser.ManagedObjectInfo.Invoke(ManagedObject obj, InvokeType invokeType, String memberName, ScriptParam[] args) at System.Windows.Hosting.ManagedHost.InvokeScriptableMember(IntPtr pHandle, Int32 nMemberID, Int32 nInvokeType, Int32 nArgCount, ScriptParam[] pArgs, ScriptParam& pResult, ExceptionInfo& pExcepInfo)

  • 我已经配置了银色的光芒项目以提升权限

这个运行在浏览器外使用的代码IA方法:

var olMail = outlook.CreateItem(0); 
      //olMail.To = txtTO.Text; 
      //olMail.Cc = txtCC.Text; 
      olMail.Attachments.Add(@"C:\\temp\\Test_pdf.pdf"); 
      olMail.Subject = "Subject of email."; 
      olMail.HTMLBody = "This is first email."; 
      olMail.Display(); 
      //olMail.Save(); 
      //You can send a mail by using Send() method. 
      //olMail.Send(); 

回答

0

当Silve浏览器中没有任何html主机页面。微软表示:System.Windows.Browser命名空间下的函数不能用于OOB模式。

编辑

我从您发布的链接抓起例子,做了以下,使其运行:

  1. 安装的应用程序 - 在浏览器中运行时,这是不行的。
  2. 注释掉://olMail.Attachments.Add(@"C:\SMOExample.bak“);
+0

谢谢,但我很困惑,为什么脂肪酶正在写文章:** http://www.devcurry.com/2011/05/silverlight-4-and-com-sending-mails.html**这是可能的? – user3009206

相关问题