2013-12-16 41 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

相關問題