0
時,我有一些代碼:錯誤使用SharpDevelop的
Outlook.Application outLookApp = new Outlook.Application();
Outlook.Inspector inspector = outLookApp.ActiveInspector();
Outlook.NameSpace nameSpace = outLookApp.GetNamespace("MAPI");
Outlook.MAPIFolder inbox = nameSpace.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox);
String sCriteria = "[SenderEmailAddress] = '[email protected]'";
Outlook.Items filteredItems = inbox.Items.Restrict(sCriteria);
// totaly sure that count > 0;
Outlook.MailItem item = filteredItems[1];
在最後一行我有錯誤:「不能型‘對象’隱式轉換爲‘Microsoft.Office.Interop.Outlook.MailItem’的明確。轉換存在(你是否缺少演員?)「。我不知道爲什麼。之前我使用過VisualStudio 2010,但我的試用版已過期。有沒有希望在SharpDevelop上運行這個?
感謝這有助於我。但我非常肯定,這段代碼在沒有強制轉換的情況下可以在VS中工作。這些工具有什麼區別嗎? – Sebastian 2010-06-08 06:36:37
您顯示的錯誤來自編譯器,而不是SharpDevelop或Visual Studio。難道你正在用SharpDevelop使用Mono框架嗎?這將使用可能給出不同消息的不同編譯器。或者,也許你在兩個開發環境中對同一個編譯器只有不同的設置。 – 2010-06-08 08:29:48