Using IntelliSense with Exchange Web Services

Topic Last Modified: 2009-07-15

You can use Microsoft Visual Studio 2005 or Visual Studio 2008 to develop client applications that use Exchange Web Services. The IntelliSense files that are included with the downloadable Microsoft Exchange Server 2007 Software Development Kit (SDK) are available to help you in your development process.

This topic describes how to set up IntelliSense for clients that use proxy classes that are generated by using wsdl.exe. This topic does not describe how to use IntelliSense for proxy classes that are generated by using the Add Web Reference wizard in the Visual Studio 2005 IDE or Visual Studio 2008 IDE. In many ways, it is better to use wsdl.exe to generate proxies than to use the Add Web Reference wizard in Visual Studio 2005 or Visual Studio 2008. You can modify the code file that is used to create the library so that you can enhance the proxy classes. This is useful because proxy assemblies that are created by using wsdl.exe can be reused in other applications. When you are using the Add Web Reference wizard, you re-create the proxy classes every time that you run the wizard.

Important

The file and namespace names that are used in this topic are used by Visual Studio to associate the IntelliSense file with the proxy library.

The IntelliSense file for Exchange Web Services is located in the directory in which the Exchange Server 2007 SDK is installed, in the \Samples\IntelliSense\EWS\ folder.

Procedure

To set up IntelliSense for proxy classes that are generated by using wsdl.exe

  1. In Visual Studio 2005 or Visual Studio 2008, open a Command Prompt Window.

    Note

    You must run the Visual Studio Command Prompt Window as an Administrator when you are using Windows Vista with User Account Control (UAC) enabled.

  2. Run wsdl.exe with the following suggested arguments:

    1. /namespace:ExchangeWebServices
    2. /out:EWS.cs
    3. The URL to the Exchange Web Services endpoint

    The following is an example of the full command:

    wsdl.exe /namespace:ExchangeWebServices /out:EWS.cs https://myServer.myDomain/ews/exchange.asmx
    

    The default code file language output is C#. If you use a namespace other than the suggested namespace, you must change the namespace in the IntelliSense file for each member to the namespace that you selected. Perform a search for ExchangeWebServices and replace it with the namespace that you created. If you use an output file name other than the suggested file name, you must change the input file in step 3 to match the output file.

  3. In a Visual Studio 2005 Command Prompt Window, run the Microsoft Visual C# 2005 Compiler version 8.00.50727.42, or in a Visual Studio 2008 Command Prompt Window, run the Microsoft Visual C# 2008 Compiler version 3.5.21022.8, with the following suggested arguments:

    1. /out:EWS_E2K7_release.dll
    2. /target:library
    3. The file name of the code file to compile. This will be the output source code file that is generated by using wsdl.exe; for example, EWS.cs.

    The following is an example of the full command:

    csc /out:EWS_E2K7_release.dll /target:library EWS.cs
    

    The suggested output file name for the proxy library matches the IntelliSense file for the initial release version of Exchange Server 2007. If the output proxy library has a different name, you must rename the corresponding IntelliSense file to match the proxy library. For example, if the proxy library is named MyLibrary.dll, the IntelliSense XML file must be named MyLibrary.xml for Visual Studio 2005 or Visual Studio 2008 to pick up the IntelliSense information.

  4. Locate the directory in which the Exchange Server 2007 SDK is installed, and open the \Samples\IntelliSense\EWS\ folder. Copy the IntelliSense XML file that corresponds to the version of Exchange 2007 that you are running and paste the file into the folder in which the proxy library is located. Change the name of the IntelliSense file so that it matches the name of the library.

  5. Create a new solution in Visual Studio 2005 or Visual Studio 2008.

  6. Add a reference to the library that you created in step 3. You can now view IntelliSense information in the Object Browser or the text editor while you are instantiating a new class.

    Note

       IntelliSense content may not exist for some types and members.