14

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.

ethem
  • 2,888
  • 9
  • 42
  • 57
  • repsponding my self: Regarding question 1: When I create a web project and try to add the microsoft.exchange.webservice I don't have any problems. But when I use a Console Project or Windows service project then after first buitld click the assembly(namespace) is unknown...????? – ethem Mar 14 '11 at 14:56

1 Answers1

38

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".

anonymous
  • 396
  • 3
  • 2
  • Thanks @anonymous! This save me so much time also. I was trying out the previous versions of the runtime (.Net 2.0 etc) but not the 4.0 version. – Shiva May 23 '12 at 21:01
  • I copied a module from a project and copied it into separate project and I checked both are .Net Framework 4 in it's properties but still in my new project where I copied it is showing the same error like ' are you missing assembly reference?'(same as above) . Any Guess?? – Shyam Dixit Dec 04 '13 at 07:03
  • i am bound to use .net 4 client profile fx.. does it means none of the EWS API version is compatible with .net 4 client profile ? – Muhammad Adnan Jul 21 '15 at 17:22
  • Thanks ...you saved my day. – Pranav Jan 05 '17 at 12:05