Team System Notifications
Team System has a built-in, extendable alerting mechanism. It is based on SQL Server 2005 Notification Services. Microsoft SQL Server Notification Services is a platform for developing and deploying applications that generate and send notifications to subscribers.
This walkthrough will help you understand the notification mechanism and provide you the knowledge needed to apply them.
Events on Team System
TFS can process the following predefined events:
|
Event |
Description |
|
AclChangedEvent |
Raised when an access control list has been changed |
|
Branchmovedevent |
Raised when a branch has been moved |
|
BuildCompletionEvent |
Raised when team build has been completed |
|
BuildStatusChangeEvent |
Raised when a team build status has been changed |
|
CheckInEvent |
Raised when a check in operation has been occurred |
|
DataChangedEvent |
Raised when a data has been changed |
|
IdentityChangedEvent |
Raised when an identity has been changed |
|
IdentityCreatedEvent |
Raised when an identity has been created |
|
IdentityDeletedEvent |
Raised when an identity has been deleted |
|
MembershipChangedEvent |
Raised when a group membership has been changed |
|
WorkItemChangedEvent |
Raised when a work item data has been changed |
Each event is passing xml data as a parameter to its subscribers. The schema of xml parameters differs from one event to another.
You can find type definitions for TFS events parameters in this folder:
[C:]\Program Files\Microsoft Visual Studio 2005 Team Foundation Server\Web Services\Services\v1.0\Transforms
Subscription types
Notifications can be delivered either in the form of an email notification or of a SOAP Endpoint (a Web Service).
Query your current subscriptions
To view a list of your current subscriptions, you have to run a query on:
Databse: TfsIntegration
Table: tbl_subscription
Query: SELECT * FROM tbl_subscription
Web service listener implementation:
Each web contains one method called "Notify". The method accepts one parameter eventXml that contains the event data based on the event's schema.
To implement the web service, use the following signature:
[SoapDocumentMethod(Action = "http://schemas.microsoft.com/TeamFoundation/2005/06/Services/Notification/03/Notify", RequestNamespace = "http://schemas.microsoft.com/TeamFoundation/2005/06/Services/Notification/03")]
[WebMethod]
public void Notify(string eventXml)
{
Enter your code here…
}
You can download TFS Notification Web Service project template from here
Subscription tool for notifications
To subscribe to one of the events, you should use the BisSubscribe.exe tool.
You can find it at: [C]:\Program Files\Microsoft Visual Studio 2005 Team Foundation Server\TF Setup
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: A filter expression. default = none
address: The email address or webmethod URL for the subscriber.
server: The Team Foundation Server name.
tag: A field to later use to identify this subscription. default = none deliveryType: EmailHtml|EmailPlaintext|Soap indicating the preferred format. default = Soap
id: The integer id for the subscription to be deleted when unsubscribing.
You can also check out open source TFS Even Subscriber GUI utility
Another way to subscribe is through the API. See this post.
Troubleshooting
(Thanks to Naren)