Share via


Hub Transport Logging Sample Agent

The Hub Transport Logging sample shows you how to create an agent that responds to the OnRoutedMessage transport pipeline event and synchronously logs the message to a file on the local hard disk.

To download this sample, download the Exchange 2010 Transport Agents SDK from the Microsoft Download Center.

Structure of the Sample

The Hub Transport Logging sample agent consists of a simple MicrosoftVisual Studio .NET 2005 C# project. By default, the files are installed in the directory in which the Exchange Server 2010 Transport Agents Software Development Kit (SDK) is installed, in the \Samples\HubTransportLogging folder.

The following are the primary files for the sample:

  • Install.ps1   An Exchange Management Shell script that installs the compiled sample.

  • Uninstall.ps1    An Exchange Management Shell script that uninstalls the compiled sample.

  • HubTransportLogging.csproj   The Visual Studio C# project file.

  • HubTransportLogging.cs   The C# source code for the sample.

Building the Sample

To build the Hub Transport logging sample agent, you must first install Visual Studio .NET 2005 and the .NET Framework version 2 on the Hub Transport server.

After you install the required software, open the C# project by using Visual Studio .NET. If it is necessary, update the references to the Microsoft.Exchange.Data.* namespaces. Build the project and fix any errors you encounter.

Installing the Sample

To install the Hub Transport Logging sample agent

  1. Edit the install.ps1 script to make sure that the $EXDIR variable is correctly initialized for your system. The value of the $EXDIR variable should be the path of the MicrosoftExchange Server 2010 installation directory.

  2. Open the Exchange Management Shell and run the install.ps1 script.

  3. Exit the Exchange Management Shell.

Uninstalling the Sample

To uninstall the Hub Transport Logging sample agent

  1. Edit the uninstall.ps1 script to make sure that the $EXDIR variable is correctly initialized for your system. The value of the $EXDIR variable should be the path of the Exchange Server 2010 installation directory.

  2. Open the Exchange Management Shell and run the uninstall.ps1 script.