Useful BuildCompletionEvent filters

In my previous post (How to filter the Build Completion Event), I explained how to change the filter for the default Build Completion event that adds to the list of builds in Team Foundation Work Item Tracking fields like "Found In Build".

What I didn't give you were the actual filters that you probably need. But first, let's talk about the fields in the event that you can filter. The following list contains the fields and a brief explanation of what they represent.

BuildCompleteTime This is the time that the build finished as a string.
BuildMachine This is the build machine used to create the build.
BuildStartTime This is the time that the build started as a string.
CompletionStatus If successful this is "Successfully Completed". Other possible values include: "Failed" or "Stopped". This value may be localized!
Configuration This is the Build Type used to create the build.
Id This is the id of the build itself.
RequestedBy This is the name of the user that requested the build.
Subscriber This is the name of the user that installed this subscription
TeamFoundationServerUrl This is the URL of the server
TeamProject This is the Team Project that the build type lives in
TimeZone TimeZone for Start and Complete time
TimeZoneOffset TimeZone offset
Url This is the URL of the build

Event filters can use the following operators: =, <>, <, >, <=, >=

Filters can be combined using 'AND', 'OR', and parenthesis.

So, what about the filter strings? The most common filter string is the one used in the previous post. It included only builds that were successful:

"CompletionStatus"='Successfully Completed'

The next one that I have heard people ask for is to add in a specific Build Type name. In my example I want all successful builds that are created from the Nightly build type. That looks like this:

"CompletionStatus"='Successfully Completed' AND "Configuration"='Nightly'

The other thing I could imagine people wanting to do is exclude a particular build type. For instance, you may want to exclude your continuous integration build type because there are just too many builds being done. That would look like this:

"CompletionStatus"='Successfully Completed' AND "Configuration"<>'Continuous'

Those seem like the most interesting filters. If you have some other need, feel free to ask. To try these out use the attachment from my previous post and give them a whirl!

Comments (11)
  1. Buck Hodges says:

    As soon as folks start using Team Build, especially with some sort of continuous integration support,…

  2. Manoj says:

    What about filter based on buld definition?

  3. Hi Manoj,

    Actually, the Configuration field mentioned above is the Definition name. This was what it was called in the original 2005 product's event xml. If you use the BuildCompletionEvent2 which was added in the 2008 product, you can use DefinitionPath. In fact, here is a list of BuildCompletionEvent2 fields:

    TeamFoundationServerUrl, Url, Title, TeamProject, AgentPath, DefinitionPath, BuildNumber, StartTime, FinishTime, ConfigurationFolderUri, SourceGetVersion, Quality, Status, StatusCode, CompilationStatus, TestStatus, LogLocation, DropLocation, RequestedFor, RequestedBy, LastChangedOn, LastChangedBy, TimeZone, TimeZoneOffset, Subscriber.

    Hope that helps,


  4. are these valid for TFS 2010 as well?  So would this be a valid filter for 2010: "CompletionStatus"='Successfully Completed' AND "DefinitionPath"='TestFull'  Where Test is the team project, and Full is the name of the build definition

  5. BisSubscribe.exe /eventType BuildCompletionEvent2 /address http://localhost:8080/tfs/WorkItemTracki

    ng/v1.0/Integration.asmx /deliveryType Soap /collection http://localhost:8080/tf

    s/DefaultCollection /filter ""CompletionStatus"='Successfully Completed' AND "DefinitionPath"='TestFull'"

  6. does BuildCompletionEvent2 update the global list as well?  What i need help on is to understand how to create a filter on either the buildcompletionevent or buildcompletionevent2 to only populate the global list of builds when a build is successful for a particular build definition…..:)

  7. I would follow the instructions on my other post and use Configuration to filter by definition. If that doesn't work, let me know. This should work for all 2008 or 2010 versions.

  8. ok thanks Jason.

    I used this option

    BisSubscribe.exe /eventType BuildCompletionEvent /address http://localhost:8080/tfs/WorkItemTracking/v1.0/Integration.asmx /deliveryType Soap /collection http://localhost:8080/tfs/DefaultCollection /filter ""CompletionStatus"='Successfully Completed' AND "Configuration"='Full'" but that didn't seem to work

    What's interesting is even if i put

    BisSubscribe.exe /eventType BuildCompletionEvent /address http://localhost:8080/tfs/WorkItemTracking/v1.0/Integration.asmx /deliveryType Soap /collection http://localhost:8080/tfs/DefaultCollection /filter ""TeamProject"='Test'

    that didn't seem to work either…and made me curious if all other fields besides CompletionStatus that i tried to AND with CompletionStatus were valid in 2010.  

    Appreciate your help.

  9. All the fields should work. If you can't figure out the problem, you should probably file a bug.


  10. is the place. Just file it under Visual Studio and the .net Framework.


Comments are closed.

Skip to main content