How to: Reference the EWS Managed API assembly
Find information about how to reference the EWS Managed API assembly.
Last modified: February 14, 2014
Applies to: Exchange Online | Exchange Server 2013 | Office 365
The EWS Managed API provides a simple and full-featured interface for developing and extending applications that use Exchange Web Services (EWS). Whether you are using Visual Studio or another code editor to develop your EWS Managed API application, you will need to make a reference to the EWS Managed API assembly. If you haven’t installed the EWS Managed API already, be sure to download it from the Microsoft Download Center.
The most common way to add a reference is to use Visual Studio. We know that some developers out there like to use other editors, so we are including instructions for using the command-line compiler as well as instructions for using Visual Studio. You might notice that the code examples that follow have the same using statements. The difference between the two methods is that the command-line compiler needs the location of the assembly file. The Visual Studio reference handles this for you behind the scenes.
To add a reference by using Visual Studio
Put the Microsoft.Exchange.WebServices.dll file and the Microsoft.Exchange.WebServices.xml file into a folder of your choice. By default, the files are installed in C:\Program Files\Microsoft\Exchange\Web Services\2.0\, but you can store the files anywhere on your computer.
In the Solution Explorer pane in Visual Studio, select References, and then choose Add Reference. This opens the Add Reference window.
In the Add Reference window, navigate to the Browse tab, browse to the location of the Microsoft.Exchange.WebServices.dll file, select that file, and then select OK.
To use the EWS Managed API in your application, add a using statement for the Microsoft.Exchange.WebServices.Data namespace.
To add a reference and build your application with the command-line compiler
Put the Microsoft.Exchange.WebServices.dll file into a folder of your choice. This folder will be the output folder for the compiler.
In your source code editor, add a using statement to the source code for the Microsoft.Exchange.WebServices.Data namespace.
Run the command-line compiler to build the application. The following command uses the .NET Framework C# compiler to build the Windows application defined in the source code file "program.cs". It assumes that the compiler is located in the default installation directory and that the Microsoft.Exchange.WebServices.dll file is in a subdirectory of the current directory named "build".