a·gen·tic a·gil·i·ty

TFS Event Handler prototype Configuration Demystified

Explains how to configure the TFS Event Handler Prototype, covering service setup, team server options, event subscriptions, handlers, and URL replacements.

Published on
4 minute read
Image
https://nkdagility.com/resources/ENx7u9d6Q6z
Subscribe

There are a number of config options for the TFS Event Handler Prototype . I will describe all of them in depth here. The first step is to set the Windows Communication Foundation service options, which really only requires you to change one value.

1<system.serviceModel>         <services>             <service name="RDdotNet.TeamFoundation.NotificationService">                 <endpoint address="http://[LocalMacheneName]:8677" binding="basicHttpBinding"
2                    bindingConfiguration="" contract="RDdotNet.TeamFoundation.INotificationService" />             </service>         </services>     </system.serviceModel>

The important one is the [LocalMacheneName] variable, which should be set to the local machine name, or the domain name that points to your computer if you have a crazy proxy.

The next step is to set the real options for this software. This starts with the < RDdotNet .TeamFoundation> options and requires you to set a number of things.

1<BaseAddress url="http://[LocalMacheneName]:3624/" />

Again you need to set the machine name, but make sure that the port is different.

 1<TeamServers>             <TeamServer name="[TFS Server Name]"
 2                        url="http://[TFS Server Name]:8080/"
 3                        subscriber="[Subscriber AD Account]"
 4                        mailAddressFrom="[From Email Address]"
 5                        mailFromName="[Form name]"
 6                        mailServer="[email relay server]"
 7                        logEvents="True"
 8                        testMode="True"
 9                        testEmail="[email to send testes to]"
10                        eventLogPath="C:tempTFSEventHandler">             </TeamServer>         </TeamServers>

In the Team Servers section you need to list all of the team servers that you are going to be handling events for. The system will automatically add the event subscriptions for all team servers added here, but I have only tested with two and I now always run the service on the TFS server.

TeamServer Options

NameTypeDescription
nameSystem.StringThis should be a friendly name for the team foundation server
urlSystem.UriThe URI for the TFS server you wish to connect to including protocol and port.
mailFromAddressSystem.StringThe address from which you want all emails sent by the system to say that they are sent.
mailFromNameSystem.StringThe display name of the from email address
mailServerSystem.StringThe mail server that you have permission for to send emails
logEventsSystem.BooleanA true or false value that enables logging of all events within that system. Excellent for debugging...
testModeSystem.BooleanWhen in test mode all emails sent by the system will only be sent to email address defined by testEmail. Set to false for production.
testEmailSystem.StringThe email address that, when testMode is enabled will receive all emails sent from the system.
eventLogPathSystem.Stringthe location that the event logs will be written to. All events received get assigned a System.Guid and all logs pertaining to that event get saved in the corresponding folder.
subscriberSystem.StringThe AD account name of the account that is writing the events. Set to the name of your TFSSetup or TFSService accounts.

Now you are ready to set the event handlers. These are defined within the “Events” section:

<Events>

<Event eventType=“WorkItemChangedEvent”>

<Handlers>

<Handler type=" RDdotNet .TeamFoundation.WorkItemTracking.AssignedToHandler"

assemblyFileName=" RDdotNet .TeamFoundation.WorkItemTracking.AssignedTo.dll"

assemblyFileLocation="~EventHandlersWorkItemTracking">

</Handler>

</Handlers>

</Event>

</Events>

As you can see you are theoretically allows to us any events. Please keep in mind that only the WorkItemChangedEvent and the CheckInEvent have been tested. When you add the “Event” tag with the corresponding eventType (which is an enumerator) this tells the system which specific events to subscribe to.

You can then add handlers to an event. These handlers are fired whenever these events are received.

NameTypeDescription
eventTypeRDdotNet.TeamFoundation.EventTypesEnumerator that  defines the list of possible events.
typeSystem.TypeThis must be a valid type in the assembly listed in assemblyFileName
assemblyFileNameSystem.StringThis must be a valid assembly found in the assemblyFileLocation
assemblyFileLocationSystem.StringA location within the servers file system that holds this assembly. ~ denotes the applications root.

If you are using friendly server names or TeamPlain the you can change the  TFS server links to be TeamPlain ones using the UrlReplacements config element:

1<UrlReplacements>             <!-- The Url Replaces change the url listed in the event to valid public items             Examples:                 This item changes the TFS url to a TeamPlain v1 url                 <Replace eventType="WorkItemChangedEvent" old=":8080/WorkItemTracking/WorkItem.aspx?artifactMoniker=" new="/workitem.aspx?id=" />                                              These items change the server location to a public host header:                 <Replace eventType="WorkItemChangedEvent" old="[ServerProductionEnviromentName]" new="[PublicProductionEnviromentUri]" />                 <Replace eventType="WorkItemChangedEvent" old="[ServerDevelopmentEnviromentName]" new="[PublicDevelopmentEnviromentUri]" />             -->
1</UrlReplacements>

This works by replacing values within the URL in the events. You specify the event type, what to look for and what to replace it by. This allows grater control and the integration of TeamPlain into your world. If a task is assigned to someone outside of your departmental sphere who you have given permission to TFS but who know nothing about it, they will still get an email that will link them through to TeamPlain.

And that is you all set. if you have installed the service and set the account that is used to run the service you should get no errors when starting. No guarantees though :)

Install and Configuration System Configuration
Subscribe

Related Blog

No related videos found.

Connect with Martin Hinshelwood

If you've made it this far, it's worth connecting with our principal consultant and coach, Martin Hinshelwood, for a 30-minute 'ask me anything' call.

Our Happy Clients​

We partner with businesses across diverse industries, including finance, insurance, healthcare, pharmaceuticals, technology, engineering, transportation, hospitality, entertainment, legal, government, and military sectors.​

Brandes Investment Partners L.P. Logo

Brandes Investment Partners L.P.

Genus Breeding Ltd Logo

Genus Breeding Ltd

NIT A/S

CR2

Kongsberg Maritime Logo

Kongsberg Maritime

Hubtel Ghana Logo

Hubtel Ghana

SuperControl Logo

SuperControl

Ericson Logo

Ericson

Cognizant Microsoft Business Group (MBG) Logo

Cognizant Microsoft Business Group (MBG)

Capita Secure Information Solutions Ltd Logo

Capita Secure Information Solutions Ltd

YearUp.org Logo

YearUp.org

Flowmaster (a Mentor Graphics Company) Logo

Flowmaster (a Mentor Graphics Company)

DFDS Logo

DFDS

Graham & Brown Logo

Graham & Brown

Boxit Document Solutions Logo

Boxit Document Solutions

Freadom Logo

Freadom

MacDonald Humfrey (Automation) Ltd. Logo

MacDonald Humfrey (Automation) Ltd.

Philips Logo

Philips

Washington Department of Transport Logo

Washington Department of Transport

Department of Work and Pensions (UK) Logo

Department of Work and Pensions (UK)

Royal Air Force Logo

Royal Air Force

New Hampshire Supreme Court Logo

New Hampshire Supreme Court

Washington Department of Enterprise Services Logo

Washington Department of Enterprise Services

Nottingham County Council Logo

Nottingham County Council

Trayport Logo

Trayport

Flowmaster (a Mentor Graphics Company) Logo

Flowmaster (a Mentor Graphics Company)

Genus Breeding Ltd Logo

Genus Breeding Ltd

Epic Games Logo

Epic Games

Jack Links Logo

Jack Links

ALS Life Sciences Logo

ALS Life Sciences