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.

2 thoughts on “Querying Overridden Check-in Policies

  1. Hope to get answer to my question.

    My "Tfs_Warehouse" database doesn't have a table called "Person". The last table within the warehouse database is "dbo.FactWorkItemToCategory".

    How could that be and/or how to fix it? Your solution is very nice.


Leave a Reply

Your email address will not be published.

Scroll to top