缺少汇编的C#错误 [英] C# error for assembly missing

查看:95
本文介绍了缺少汇编的C#错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么我遇到以下错误?我导入了我需要的所有程序集引用.

Why i am getting the following error? I imported all the assembly references that i need.

Error	3	''Microsoft.Office.Interop.Outlook._Folders'' does not contain a definition for ''Item'' and no extension method ''Item'' accepting a first argument of type ''Microsoft.Office.Interop.Outlook._Folders'' could be found (are you missing a using directive or an assembly reference?)	D:\MIT\project\project development three\E-mail filter\E-mail filter\Main Form.cs	343	57	E-mail filter



以下是我尝试过的代码:



following is the code that i tried:

OutLook._Application olApp = new OutLook.ApplicationClass();
OutLook._NameSpace olNS = olApp.GetNamespace("MAPI"); OutLook._Folders oFolders;
oFolders = olNS.Folders;
OutLook.MAPIFolder oPublicFolder = oFolders.Item("Public Folders");
oFolders = oPublicFolder.Folders;
OutLook.MAPIFolder oAllPFolder = oFolders.Item("All Public Folders");
oFolders = oAllPFolder.Folders;
OutLook.MAPIFolder oMyFolder = oFolders.Item("My Public Folder");
Console.Write(oMyFolder.Name);




我正在此代码上方链接http://support.microsoft.com/kb/310244

根据此链接,他们使用的是Microsoft Outlook 10.0对象库,但我使用的是Microsoft Outlook 12.0对象库,

请告诉我我需要做什么..




i am following this link for above code http://support.microsoft.com/kb/310244

according this link they r using Microsoft Outlook 10.0 Object Library, but i am using Microsoft Outlook 12.0 Object Library,

pls tell me wht i need to do ..

推荐答案

Kasunmit写道:
Kasunmit wrote:

"Microsoft.Office.Interop.Outlook._Folders"不包含"Item"的定义,也没有扩展方法"Item"接受类型为"Microsoft.Office.Interop.Outlook._Folders"的第一个参数可以找到

''Microsoft.Office.Interop.Outlook._Folders'' does not contain a definition for ''Item'' and no extension method ''Item'' accepting a first argument of type ''Microsoft.Office.Interop.Outlook._Folders'' could be found



如果仔细阅读错误,您会发现它不是缺少的装配错误.实际上,这是对装配体的错误引用.
更清楚地说,您正在尝试访问某些在导入/引用的程序集中未公开的属性/方法.

您只需要引用正确的Interope DLL,该DLL就会公开您要使用的所有那些属性/方法.



If you read the error carefully, you will find it''s not the missing assembly error. It''s actually sort of wrong reference to an assembly.
To be more clear, you are trying to access certain properties/methods that are not exposed in the assembly that you have imported/referenced.

You just need to refer the correct Interope DLL, that has all those properties/methods exposed that you are trying to use.


看,这就是您的问题.您引用的代码适用于Outlook2002.

获取Outlook 2002 dll或根据新代码进行编码.我会选择新的,因为我很少相信有人会再使用Outlook 2002!

我建议您在此处 [ http://www.c-sharpcorner.com/uploadfile/rambab/outlookintegration10282006032802am/outlookintegration.aspx [ ^ ]
这可能是兼容的.
See, thats your issue. Code that you are referring to is for Outlook 2002.

Either get Outlook 2002 dll or make your code as per new one. I would go for new one as i rarely believe anyone would be using Outlook 2002 anymore!

I would suggest you to look here [^]of what you need.

BTW, have a look at this article if this helps:

http://www.c-sharpcorner.com/uploadfile/rambab/outlookintegration10282006032802am/outlookintegration.aspx[^]
This might be compatible.


这篇关于缺少汇编的C#错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆