Building the Template

Topic Last Modified: 2006-06-11

Prior to building the protocol sink, you must have the following software and files on your computer:

  • Microsoft® Visual Studio® 6.0 (Microsoft Visual C++® must be installed)
  • Microsoft Platform Software Development Kit (SDK)
  • Protocol sink template files
  • Microsoft Exchange Server 2003 must be installed on the target computer
  • Microsoft Windows® 2000 Service Pack 3 (SP3) or later, or Microsoft Windows Server™ 2003

To build the protocol sink

  1. In Visual C++, create an empty DLL project named "SampleFilter".
     

    Note

    If you want to name your project something other than "SampleFilter", change this string in SampleFilter.def.

  2. Add the protocol sink files (*.cpp, *.h, *.rc, *.idl, *.rgs, *.def) to the project. The default folder for these files is \Program Files\Exchange SDK\SDK\Samples\CustomFilterSink. Also include all of the header files under the \Program Files\Exchange SDK\SDK\Samples\CustomFilterSink\extra folder.

  3. Add seo.idl, smtpevent.idl, and mailmsg.idl files to the project from the \Microsoft SDK\include folder (the default folder for the Platform SDK include files).

  4. In Project Settings, on the MIDL tab, clear the MkTypLib compatible check box (this removes the /mktyplib203 project option).

  5. In Tools, Options, on the Directories tab, select Include files in the Show directories for list. Add the path to the Platform SDK include folder (\Microsoft SDK\include), the path to the protocol sink files, the path of the "extra" folder, and the path to your project to the Directories list.
     

    Note

    Move the paths you added to the first four positions in the Directories list, so that the files in the Visual Studio include folder are not used.

  6. Build the project. This produces the DLL.
     

    Note

    When building the project, 14 of the following warnings are produced in reference to the seo.idl file: "warning MIDL2039 : interface does not conform to [oleautomation] attribute". This is expected behavior.

  7. Register the DLL using regsvr32 on the Exchange Server 2003 computer. Registering the DLL will also bind the COM object to the SMTP event sink in the metabase. For example:

    C:\> regsvr32 SampleFilter.dll