Use the following query to pull back a list of check-in policy overrides. This works for Visual Studio Team Foundation Server 2010. The Tfs_DefaultCollection database should be updated to match the name of your team project collection database.
USE [Tfs_DefaultCollection]
SELECT cs.[ChangeSetId], cs.[CommitterId], cs.[OwnerId], cs.[Comment], po.[Comment] AS [Override Reason],
c.DisplayPart, cs.CreationDate, pf.[PolicyName], pf.[Message]
FROM [tbl_PolicyOverride] AS po
INNER JOIN [tbl_ChangeSet] AS cs ON po.[ChangeSetId] = cs.[ChangeSetId]
INNER JOIN [tbl_Identity] AS i ON cs.[OwnerId] = i.[IdentityId]
INNER JOIN [Constants] AS c ON i.[TeamFoundationId] = c.[TeamFoundationId]
LEFT OUTER JOIN [tbl_PolicyFailure] AS pf ON cs.[ChangeSetId] = pf.[ChangeSetId]
WHERE cs.[CommitterId] = cs.[OwnerId]
ORDER BY c.[DisplayPart], cs.[CreationDate]
The WHERE clause makes sure the query doesn’t return policy overrides that are created by the build service when committing Gated Check-ins.
jb
1 comment:
is there an equivalent TFS sdk way of querying this?
Post a Comment