TFS Alerts: From address and filtering
On internal mailing list, the following questions came up regarding the auto-generated check-in mails from TFS.
- Can the ‘from’ address be customized to be the email address of the developer who did the check-in? It seems to default to the service account.
- Is it possible to customize the subscription (e.g., using bissubscribe) to send check-in mail for everyone except check-ins performed by a specific account? I looked at the event schema in the database and I saw an example of using a filter on the subscription but it isn’t clear which field we would filter on. The ‘committer’ field is optional in the schema, so I doubt that’s the correct one. Is the ‘checked in by’ field one of the name-value pairs? If so, how would you filter this? An example would be great.
Jeff Lucovsky replied with the following information, which I’ve edited slightly.
- There is no mechanism in V1.0 to have the From address contain the address of the developer who checked in the code. There were issues, internally, when the internal smtpHost required the From address to match that of the caller (in this case, the identity assigned to the application pool for TFS).
We do set the Reply-To address to the developer’s email address, so you can change Outlook to show the Have Replies Sent To values instead of the From values. Right click on the column headers in the Outlook email display and choose Customize Current View and then click the Fields button. In the combo box titled “Select available fields from,” choose “Address Fields,” select the “Have Replies Sent To” entry, click Add, and then move it up to the desired location.
- You want to filter on CheckinEventOwner (the Commiter is set if one account performs the checkin on behalf of another account). The filter will be something like the following. “Artifacts/Artifact[@TeamProject = ‘VSTS Rocks‘]” <> null AND ‘Owner” <> ‘YourDomainYourUserName’
In an earlier email, a similar question regarding work item tracking alerts came up.
Does anyone know of a way to define rules to trigger automated email notifications when a certain field’s value in a work item is changed?
There is a way to do it through a command line tool called BisSubscribe, which is available in the SDK. If the field is a string, the filter syntax is the following:
“PortfolioProject = ‘<project name>’ AND ”ChangedFields/StringFields/Field[ReferenceName='<field name>’]/NewValue” <> null”
BisSubscribe.exe /eventType WorkItemChangedEvent /deliveryType EmailHtml /server MyServer /address email@example.com /filter “PortfolioProject = ‘My Project’ AND ”ChangedFields/StringFields/Field[ReferenceName=’System.State’]/NewValue” <> null”
If it’s an integer, the syntax is
“PortfolioProject = ‘<project name>’ AND ”ChangedFields/IntegerFields/Field[ReferenceName='<field name>’]/NewValue” <> null”
So while I was going through old email, I found another piece of information from Pete regarding the list of server events in TFS v1.
To enumerate the list of event types in a given system you would have to look both at the files in that Transforms folder and in the Registration data (http://machinename:8080/Services/v1.0/Registration.asmx). Inside the Registration data you can see that each registered ServiceInterface can register a list of EventTypes. There is not an API for inserting the event types in the Registration data, but you may use the command-line tool TfsReg to do it.
You can find more information about the events in the Visual Studio SDK. The current release is Visual Studio 2005 SDK – March 2006 CTP for v2 (free download after you register).
If you need to remove a subscription, you’ll need to do it the hard way for right now. The BisSubscribe included in the March SDK doesn’t have an option for removing a subscription, even though the RTM code has that option (/unsubscribe). I’ve sent email about it, so hopefully it will get updated in a future release. In the meantime, Ahmed Salijee has a post on the issue.
[UPDATE 10/07/06] The bissubscribe.exe installed on the AT in the Team Foundation server installation folder does have the /unsubscribe option.