Querying Overridden Check-in Policies

In the Team Foundation Server, you can enable certain policies for checking in files. The default install will contain policies that can verify that the check-in is associated with a work item, or that unit tests were created for the changes made, etc etc. But even though certain rules were made for checking in, the user is still given the possibility to override these policies, if the user decides to override the policy then the user is prompted with a dialog, where the user can input their “reason” for ignoring such policies. This action is logged to the TFS databases.

In this article I will show you how to query the database TfsVersionControl and TfsWarehouse to get more information for the overridden check-in policy.

let’s start off with openning a query to the database server that TFS uses then type in the following query:

    'Changeset ID'=p.ChangeSetId,
    'Creation Date'=cs.CreationDate,
    'Check-in Comment'=cs.Comment,
    'Override Reason'=p.Comment,
    TfsVersionControl..tbl_PolicyOverride p
    TfsVersionControl..tbl_ChangeSet cs ON p.ChangeSetId=cs.ChangeSetId
    TfsVersionControl..tbl_Identity i ON cs.OwnerId=i.IdentityId
    TfsWarehouse..Person pr ON i.DisplayName=(pr.Domain+'\'+pr.Alias)
    cs.ChangeSetId DESC

This query will provide you with the change set number, date, check-in comment, override reason, change set owner and email address for every overridden check-in policy.

My first ever blog post

After being asked numerous times why I don’t have a blog, I finally decided that maybe I should have one.

For a short introduction: My name is Christian Resma Helle, I was born and raised in the Philippines. I currently reside and work in Copenhagen, Denmark. I work as a Developer/Consultant specializing in Windows Mobile based solutions and have taken an interest in the Visual Studio Team System.

My blog would probably contain technical articles regarding Windows Mobile development and the VSTS.