How to Configure TFS Notifications in Team Foundation Server 2010
TFS notifications are useful in sending alerts when a work item is changed, the build is completed, build property changed etc. When I did it for the first time I had to research many articles to find what exactly to be done. So I thought of making that knowledge available in one article.
This article provides details of configuring and administering TFS notifications including my experiences.
Requirements:
These configurations are from Team Foundations server 2010 RTM. They are similar in other TFS 2010 versions.
You need is a SMTP mail server that will relay the messages originated from TFS server. It does not need to be on the same domain as the TFS server.
The Clients need the have the Visual Studio. In my setup VS2010 premium and VS2010 Ultimate is used.
Configurations on the TFS server
ON the Team Foundation Server, Open the Team Foundation Server Administration Console.
Application Tier>Alert Settings.
Enable the service, Add the SMTP server and EmailFrom address.
The emails are queued to the mail server by the TfsJobAgent.
If your mail server port is different from TCP 25 then you can configure it in TfsJobAgent.exe.config file located at,
C:\Program Files\Microsoft Team Foundation Server 2010\Application Tier\TFSJobAgent
Add the following entry in the TfsJobAgent.exe.config file and restart the ‘Visual Studio Team Foundation Background Job Agent’ service.
<system.net>
<mailSettings>
<smtp >
<network host="10.0.0.25" port="2525" />
</smtp>
</mailSettings>
</system.net>
The TFS web service configuration file can be used to control the notification behavior. It is located at C:\Program Files\Microsoft Team Foundation Server 2010\Application Tier\Web Services\web.config
In my setup the 'emailNotificationFromAddress' configurations from this web.config file was not effective as it took the 'EmailFrom address' configuration in TFS Admin console.
<appSettings>
<add key="applicationDatabase" value="Data Source=TFS2;Initial Catalog=Tfs_Configuration;Integrated Security=True;" />
<add key="WorkItemTrackingCacheRoot" value="C:\Windows\Temp\TFTemp" />
<add key="traceWriter" value="false" />
<add key="traceDirectoryName" value="%TEMP%\TFLogFiles" />
<add key="applicationId" value="3e10ce73-02e0-4c7f-93fa-957a03953538" />
<add key="smtpserver" value="10.0.0.25" />
<add key="emailNotificationFromAddress" value="tfsweb@domainname.com" />
</appSettings>
Configurations on Clients
You need to Subscribe/Unsubscribe to TFS notifications from the Visual Studio 2010 client.
- Open Visual Studio 2010.
- Connect to Team Project Collection.
- View the Team Explorer.
- Right click on Project name and select Project Alerts (Alert Explorer)
- Select the events that you want to subscribe and your email address. (It is recommended you check at least “My work items are changed by others” and My “My build completes”.
Monitoring and Administering
** **
If the notifications are not working first check the ‘Visual Studio Team Foundation Background Job Agent’ service is running.
Open command prompt and telnet to the email server to see if the connection is fine. (You will need to install the ‘Telnet Client” feature in Windows 2008)
cmd>telnet 10.0.0.25 2525
The event for TFS are available in,
Server Manage>Diagnostics>Event Viewer>Custom Views>Server Roles>Administrative Events
You can monitor the Subscripts in the TFS database tables. The event notifications are in tfs_ProjectCollectionName database in the table tbl_eventSubscription
You can find the ID for a particular subscription from this table.
Subscribe
Administering the subscriptions can be done in command console by the administrator. (The command parameters are case sensitive.)
This is useful when you want to enable notifications sent to a user who don’t have Visual Studio 2010.
C:\Program Files\Microsoft Team Foundation Server 2010\Tools>bissubscribe /event
type CheckinEvent /address email@domainname.com /collection http
://server:8080/tfs/ProjectCollectonName /deliveryType EmailHtml
BisSubscribe - Team Foundation Server BisSubscribe Tool
Copyright (c) Microsoft Corporation. All rights reserved.
TF50001: Created or found an existing subscription. The subscription ID is 71.
C:\Program Files\Microsoft Team Foundation Server 2010\Tools>
Unsubscribe
bissubscribe is also useful if TFS administrator has to stop notifications for a user went on vacation and forget to stop notifications by him, if a user’s email changed or removed without unsubscribing the notifications etc.
C:\Program Files\Microsoft Team Foundation Server 2010\Tools>bissubscribe /unsubscribe /id 41 /collection http://TFS2:8080/tfs/ProjectCollectionName
BisSubscribe - Team Foundation Server BisSubscribe Tool
Copyright (c) Microsoft Corporation. All rights reserved.
TF5004: Successfully unsubscribed subscription 41.