Platform SDK: Exchange Server

Building the Sample Applications

Before building the samples, you should make sure you have set up Developer Studio and Visual C++ as outlined in the Development Environment section. This basically consists of two steps:

  1. Setting Up Visual Studio and Visual C++
  2. Building the Exchange Libraries

Once completed, you can proceed to build the samples. With this release of the Platform SDK, all of the Exchange programming samples can be compiled and linked directly from the Developer Studio environment. The directory <c:\mssdk>\Samples\DBMSG\EXCHANGE\SAMPLES directory contains a workspace file EdkSamples.dsw that can be used to do so. Additionally, each sample has a separate project file (*.dsp) that can be used to build it separately if desired. The steps are listed below.

Steps for Building A Sample in Visual Studio

  1. Open the workspace EdkSamples.dsw by double-clicking or using Visual Studio.
  2. Select the Project you'd like to build by selecting it from the available projects located in the project explorer window. (usually on the left. If you can't see it, select View->Workspace (Alt - O)) You right-click and choose the Set As Active Project option. The chosen project should now be bold.
  3. Choose the desired Active Configuration as Win32 Release or Win32 Debug. To do this, select Build->Set Active Configuration. The default is Win32 Release.
  4. Select Build->Build <name>.exe or <name>.dll (F7)
  5. You can also select Build->Batch Build to build more than one sample at the same time.

Linking Debug and Release Configurations to the Exchange Library

The debug versions of all the samples link against the library "exchsdkd.lib". The release versions link against the library "exchsdk.lib." (The only difference in the name is the trailing "d" character). If you have not compiled and linked either the debug or release library, or if for some reason the library was not successfully copied to the <c:\mssdk\lib> directory, the link step for the sample will generate an error:

LINK : fatal error LNK1104: cannot open file "exchsdkd.lib"
Error executing link.exe.

These libraries must be in a \LIB directory that is visible in the "Library files" Directories option within Developer Studio. When the library is built, a post-build step copies them it the %BkOffice%\LIB directory as described in the section Development Environment. If you are experiencing problems in the link step for a sample, check to make sure the required library file has been copied properly to the c:\mssdk\lib directory.

ASP Samples

For some of the ASP samples, you first need to do the following:

  1. Make sure you have the appropriate server software and service packs installed.
  2. If a COM component provided by the Platform SDK is required for the sample, you must
    1. 1. Build the required COM component.
    2. 2. Register the component on the server machine.
  3. Configure the new IIS virtual directory for the ASP application sample.

The proceeding steps are discussed in the following sections.

Building and Registering the COM Components

The following steps outline how to build and register the COM components provided for Exchange Server in the Platform SDK.

  1. Open the Visual Studio workspace file for the COM component
  2. Select the desired configuration. This can be done using the Build pull-down menu.
  3. Select Build->Build <name>.dll (F7)

The component is registered automatically by Visual Studio after the build is complete. If you have built the component on a different machine than the one on which you would like to run the sample, you will need to copy the component to that machine and register it. At the command prompt, type the following:

regsvr32.exe <name>.dll

To unregister the component, type

regsvr32.exe /u <name>.dll

Note  If you use Microsoft Visual Studio 6.0 to build the components, and you select a MinSize active configuration for any of them, you will need to copy the ATL.DLL version 3.0 library onto the machine you install the component. This library is a part of the Visual Studio 6.0 product.  The MinSize configurations use code contained in this dynamic link library and it is therefore required for the component to run properly. 

Configuration Internet Information Server for the ASP Samples

Some of the samples are Active Server Pages (ASP) samples. In order to run these samples, you will need to configure Internet Information Server (IIS). These steps are outlined in the following list.

  1. Open the Microsoft Management Console IIS Snapin.
  2. Select a Web Site that you plan to use for a sample.
  3. Right-Click to Select New->Virtual Directory.
  4. Fill in the required properties for the directory. You can use any name and alias for the sample. Choose names that are easy to remember. Map the virtual path to the sample's location.
  5. Set up a new application and make sure it is configured to use the component asp.dll for files with the extensions .asp and .asa.
  6. If required, copy the sample files into the physical directory you mapped in step 4.
  7. Set the directory permissions for the application. You should disable anonymous access and select Basic Auth, NTLM auth, or both. Using Basic Auth is required if you run the ASP sample on a different machine than the one running Exchange server.