TFS Event Handler for Team Foundation Server 2010

I am looking at re-working the TFS Event Handler and I was hoping that you would help me decide what handlers to build!

[Request an event handler]

The original Event Handler sends emails when:

  • A work item is assigned to you
  • A work item that is assigned to you is reassigned to someone else
  • A work item that you created is assigned to someone else.

The TFS Event Handler that I built for Team Foundation Server 2005 and Team Foundation Server 2008 used a service subscription to then handle events in a separate service host. This posed its own problems of writing the wrapper, API and host for the handlers. Well, now the Team Foundation Server team have stepped up and created their own.

The new TFS Event Handler will use these new Server Event Sinks to process the events more efficiently and quickly, but there is also the option to handle certain decision points on the server. This opens the window for Server Side check-in policies as well as a whole host of other options. These events should run more efficiently and benefit from the entire TFS Object Model that was extremely inefficient to load in the old Event Handlers.

There are lots of new integration points so I have listed all of the events here so you can get an idea what can be achieved.

[Request an event handler]
Version Control Decision Notification
CheckinNotification Has this feature Has this feature
PendChangesNotification Has this feature Does not have this feature
UndoPendingChangesNotification Has this feature Has this feature
ShelvesetNotification Has this feature Has this feature
WorkspaceNotification Has this feature Has this feature
LabelNotification Does not have this feature Has this feature
CodeChurnCompletedNotification Does not have this feature Has this feature

Figure: Version Control events

Build Decision Notification
BuildCompletionNotificationEvent Does not have this feature Has this feature
BuildQualityChangedNotificationEvent Does not have this feature Has this feature

Figure: Work Item Tracking events

Work Item Tracking Decision  
WorkItemChangedEvent Does not have this feature Has this feature
WorkItemMetadataChangedNotification Does not have this feature Has this featureminimal
WorkItemsDestroyedNotification Does not have this feature Has this featureminimal

Figure: Team Build Events

Test Management Decision Notification
TestSuiteChangedNotification Does not have this feature Has this feature
TestRunChangedNotification Does not have this feature Has this feature
TestPlanChangedNotification Does not have this feature Has this feature
TestCaseResultChangedNotification Does not have this feature Has this feature
TestPointChangedNotification Does not have this feature Has this feature
TestRunCoverageUpdatedNotification Does not have this feature Has this feature
BuildCoverageUpdatedNotification Does not have this feature Has this feature
TestConfigurationChangedNotification Does not have this feature Has this feature

Figure: Test Manager Events

Framework Decision Notification
StructureChangedNotification Does not have this feature Has this feature
AuthorizationChangedNotification Does not have this feature Has this feature
IdentityChangedNotification Does not have this feature Has this feature
SecurityChangedNotification Has this feature Has this feature
SendEmailNotification Has this feature Does not have this feature
HostReadyEvent Does not have this feature Has this feature

Figure: Framework Events

I will do a series of blog posts as I build the handlers so you can build your own, but I wanted to get the most common cases pre-built and ready to go. I know that emailing an assignment is a good one to start with, but what else do you see on the cards?

The Email handlers would not work so well in the Scrum environment, but what would?

[Request an event handler]
Technorati Tags: ,,
  • Allen

    Can we get a notification of when a branch is created, say send email to all [Team Project]Contributors?

    • Ricardo Serradas

      Yeah, you can. Once you got the event, it becomes easy to do whatever you want 🙂

      Just use some sort of code like the print I attached.

  • Rohan

    Actually whatever you choose is right.I pray that you benefit from the entire TFS Object Model.

  • Amy Grossman

    How about one that reminds your project manager/tech lead/director to sign off on a requirement or change pending approval from them? Like a repeat auto-reminder cycle with x number of days depending on the priority of the item….

  • What dll has TestRunChangedNotification defined in it?  I have everything working for WorkItemChangedEvent.  But when I try to use TestRunChangedNotification Visual Studio can’t find a reference to it.

    • The “TestRunChangedNotification” class is in the “Microsoft.TeamFoundation.TestManagement.Server” namespace in the “Microsoft.TeamFoundation.TestManagement.Server” assembly which you can find in “C:Program FilesMicrosoft Team Foundation Server 2010Application TierWeb Servicesbin”

      Filepath:

            C:Program FilesMicrosoft Team Foundation Server 2010Application TierWeb Servicesbin

      Assembly: 

            Microsoft.TeamFoundation.TestManagement.Server, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a

      Fully Qualified Class Name:      Microsoft.TeamFoundation.TestManagement.Server.TestRunChangedNotification

      • Thank you so very much for pointing me to this.  It is going to help me automate the testing scenario for my company very nicely!

  • Anonymous

    Is there any way to get a list of files as part of the PendChangesNotification event? on TFS2010
    currently the place where it should be within NotificationEventArgs is currently empty
    I’ve tried to be clever and pull it from the method parameters within the request context, but this is limited to the first 10 files checked out

  • Anonymous

    Is there any way to get a list of files as part of the PendChangesNotification event? (within TFS2010 SP1)
    the place where it should be under notificationEventArgs.PendingChanges tends to be empty on the event
    I’ve tried to be clever and pull it from the method parameters from the request context, however this is limited to 10 files, trying to check out any more than this , and they’re not contained within this location

    • Richard, The Change Set has already been committed so all you need is the number ( event.Number) and use the VersionControlServer.GetChangeset method to retrieve it.Resource: http://blogs.msdn.com/b/buckh/archive/2009/02/09/why-the-checkinevent-doesn-t-list-all-of-the-files-in-a-changeset.aspxhttp://msdn.microsoft.com/en-us/library/bb138627.aspx-MrHinsh

  • Pingback: TFS 2010 – Capturer des évènements serveurs grâce à un plugin | Guillaume BROUT()

  • Dominick Meglio

    Is TFS Event Handler officially dead? I really need a good tool to automate emailing…

    • Why would you say that it is dead? Works with 2005, 2008 and 2010 currently and many of these features are built into Visual Studio 11…

  • vletroye

    I found also a “TeamFoundationNotification” among the Framework Events. Possibly to be added in your list (with the availability of Decision/Notification) ? Or is it not an event foreseen to be handled as the other ones ?

  • Pingback: Create a Team Foundation Server event handler | VGALTES.COM()

  • Pingback: TFS Event Handler for Team Foundation Server | Cose inutili ma utili...()

  • Pingback: Disable Local Workspaces in TFS 2013 - A WordPress Site()

  • Pingback: Subscribe to TFS Event Handler using a TFS Plugin | Automation Planet()

  • Ivan Ponomarenko

    Hi, do you have any updated information on the list of events for the Team Foundation Server 2012?
    I am very interested in how to subscribe to an event creating/deleted team project, iteration and areas.

    • I don’t believe that there are any events for that. You could create an event hander that grams all events and log them… then go change stuff and see whats fired…