2011-05-18 30 views
0

我在遠程服務器上有一個電子郵件帳戶。 我創建了一個應用程序,它利用outlook interop api來搜索具有特定主題的電子郵件,而不是從中提取附件並將​​其保存到目錄。用於接收電子郵件的Outlook互操作API的替代方案

手動運行該應用程序時,一切正常。 但是,當我創建計劃任務爲這個應用程序,我得到

Stack: 
    at System.Runtime.Remoting.RemotingServices.AllocateUninitializedObject(System.RuntimeType) 
    at System.Runtime.Remoting.Activation.ActivationServices.CreateInstance(System.RuntimeType) 
    at System.Runtime.Remoting.Activation.ActivationServices.IsCurrentContextOK(System.RuntimeType, System.Object[], Boolean) 
    at System.RuntimeTypeHandle.CreateInstance(System.RuntimeType, Boolean, Boolean, Boolean ByRef, System.RuntimeMethodHandleInternal ByRef, Boolean ByRef) 
    at System.RuntimeType.CreateInstanceSlow(Boolean, Boolean, Boolean) 
    at System.RuntimeType.CreateInstanceDefaultCtor(Boolean, Boolean, Boolean, Boolean) 
    at System.Activator.CreateInstance(System.Type, Boolean) 
    at PocketDataFromEmail.EmailManager..ctor() 
    at MyApp.Program.Main(System.String[]) 

據說,前景並不適合那種情景: Is Interop.Outlook multithreaded?

如何檢查的收件箱中的任何想法交換帳戶並提取附件而不使用outlook interop api? 謝謝。

回答

0

在您的情況,它是適合使用Exchange Web服務,如上面的PeskyGnat所述,因爲它不需要在計算機上安裝MS Outlook。

您可能還會看到Aspose.Network for .NET組件(一種商用API),它可以從具有完整附件的Exchange,Imap和Pop3郵件服務器獲取消息。有關示例代碼,請參閱http://www.aspose.com/documentation/.net-components/aspose.network-for-.net/saving-messages-from-exchange-server-mailbox-in-eml-and-msg-format.html以從Exchange Server讀取消息。

披露:我在Aspose擔任技術推廣人員。