Microsoft.Exchange.WebServices 在 VS2010 中不起作用
我使用 EWS ExchangeService 从 Outlook 读取电子邮件...我已经在控制台项目和 VS2008 中编写了代码...一切正常..我可以阅读电子邮件。
为了更加熟悉 VS2010,我创建了一个控制台项目并将其复制到 VS2010 项目。
所以我在 Microsoft\Exchange\Web Services\1.1\Microsoft.Exchange.WebServices.dll 文件夹中添加了引用“Microsoft.Exchange.WebServices”(版本 14.2.51.0)。
一切都按原样进行,所以我看到了智能,我看到了 Exhange 程序集的方法属性等...
使用 Microsoft.Exchange.WebServices.Data;
第一个问题:
问题: - 当我点击 VS2010 中的构建按钮...我收到此错误: 命名空间“Microsoft”中不存在类型或命名空间名称“Exchange”(您是否缺少程序集引用?)在此处形成 Exchange 程序集的所有方法/属性都被挤压下划线...智能不再适用于 Exchange 程序集。当我从引用中删除程序集并重新添加时,我再次获得交换程序集的智能...但是当我单击构建时它会再次发生:( 所以我进入我的代码并输入“Microsoft”。我不再看到 Exchange 这个词了...
所以我不明白为什么会发生这种情况,它在 VS2008 上工作,而在 VS2010 上不起作用?我认为唯一的方法是 VS 是 Framework 3.5,而 VS2010 是 V4.0
知道去哪里找吗?以及如何解决这个问题?
第二个问题:
- 我需要获取电子邮件的附件。因此,当电子邮件到达特殊电子邮件帐户时,我需要获取附件并将附件文件保存到特定文件夹。这里最好的方法是什么?在控制台项目中创建代码并创建Windows服务项目?或者只是控制台项目或只是 Classlibrry 项目并添加到任务计划程序?所以我需要一些关于如何在项目级别进行处理的建议......编程逻辑已经在那里工作了。
但正如我在第一个问题中所说,我在 VS2008 中可以正常工作,但在我按下“构建”按钮后,VS2010 不知道 Exchange 程序集。
I'n using EWS ExchangeService to read emails from outlook... I've coded the in Console project and in VS2008... Everything works fine as it is.. I can read the emails.
To become more familair with VS2010 I created a console project and copied the copied to VS2010 project.
so I added the referene "Microsoft.Exchange.WebServices" (Version 14.2.51.0) in Microsoft\Exchange\Web Services\1.1\Microsoft.Exchange.WebServices.dll folder.
Everything works as it is, so I see the intellisence, I see the methods properties of Exhange assembly etc...
using Microsoft.Exchange.WebServices.Data;
1st Question:
The issue:
- As soon as I click on the build button in VS2010... I get this error:
The type or namespace name 'Exchange' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?) Form here all the methods/properties of Exchange assembly get squeezed underline... Intellisence is not working for Exchange assembly anymore. When I remove the assembly from reference and re-added I get the intellesence back again for Exchange assembly... but it happens again when I click on build :(
so I goto my code and type "Microsoft." I don't see the Exchange word anymore....
So I don't understand why this occurs, it works on VS2008 and in VS2010 it's not working? The only way I think is VS was Framework 3.5 and VS2010 is V4.0
any idea where to look? and how to solve this problem?
2nd question:
- I need to get attachments of the email.. so when email arrives on special email account, I need to get the attachment and save the attachment-file to a specific folder. What's the best approach here? Create the code in Console project and create Windows service project? or just Console project or just Classlibrry project and add to Task Scheduler? So I need some advice on this how to approach at project level... The programming logic is already there working.
But as I said in my first question I got it working in VS2008 but VS2010 doesn't know th Exchange assembly after I press the Build button.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
问题 1 的回答:您需要将项目中的目标框架从“.NET Framework 4 Client Profile”切换为“.NET Framework 4”。
Answer to Question 1: You need to switch the target framework in your project from ".NET Framework 4 Client Profile" to just:".NET Framework 4".