Subscribing to Team Foundation Server Events
In my previous post, Setting up Continuous Integration with Team Build, you probably noticed that all we really did was set up a simple web service that subscribed to the check-in event on the Team Foundation Server.
One might ask, then, what other Team Foundation Server events can I subscribe to?
Here's a list, in alphabetical order, of all the Team Foundation Server events in version 1.0:
| TFS Event name | Notes
|
| AclChangedEvent | !
|
| BranchMovedEvent |
|
| BuildCompletionEvent | *
|
| BuildStatusChangedEvent |
|
| CheckinEvent |
|
| CommonStructureChangedEvent |
|
| DataChangedEvent | *
|
| IdentityChangedEvent |
|
| IdentityCreatedEvent | !
|
| IdentityDeletedEvent | !
|
| MembershipChangedEvent | !
|
| NodeCreatedEvent |
|
| NodePropertiesChangedEvent |
|
| NodeRenamedEvent |
|
| NodesDeletedEvent |
|
| ProjectCreatedEvent | *
|
| ProjectDeletedEvent |
|
| WorkItemChangedEvent |
|
(!) = These events may not work properly, per Microsoft's Pete Sheill
(*) = These events are used internally by TS itself in a default TFS install
You can use the bissubscribe.exe command-line utility to subscribe and unsubscribe from these events:
C:\>BisSubscribe.exe
BisSubscribe - Team Foundation Server BisSubscribe Tool
(C) Copyright 2006 Microsoft Corporation. All rights reserved.
BisSubscribe.exe
Usage:
BisSubscribe /eventType /address [/deliveryType EmailHtml|EmailPlaintext|Soap]
[/server ] [/filter ] [/tag ]
BisSubscribe /unsubscribe /id [/server ]
where:
eventType: The name of the event. Case sensitive.
filter: (default none) A filter expression.
address: The email address or webmethod URL for the subscriber.
server: The Team Foundation Server name.
tag: (default none) A field to later use to identify this subscription.
deliveryType: (default Soap) EmailHtml|EmailPlaintext|Soap indicating the preferred format.
id: The integer id for the subscription to be deleted when unsubscribing.
Unfortunately, although you can add and delete subscriptions to your heart's content, there's no way to list what subscriptions currently exist on the Team Foundation Server. It's an odd oversight. To see the subscription list, you have to run a query on a TFS table, TfsIntegration.tbl_subscription:
You can clearly see where a few of these subscriptions are set via the Team System Email Notifications UI. And there's our continuous integration subscription at the bottom, too.
If you look in the
C:\Program Files\Microsoft Visual Studio 2005 Team Foundation Server\TF Setup
folder on the server, you'll find even more information on these events, including xsd definitions, email templates, and more:
But if you're thinking about creating your own custom ad-hoc event integration, I recommend checking out these great pre-built Visual Studio 2005 samples contributed by the Team System community:
If you know of any other helpful TFS event handling code samples, please post a reference to them in the comments!