TFS Queries - How to determine who created a shared query and when

人盡茶涼 提交于 2019-12-11 02:38:22

问题


We are using TFS 2012 and have hundreds of Shared Queries that have been created over time due to poor oversight. In order to clean these up and provide a common set of shared queries, we'd like to determine who created the queries and when, similar to work item type history.

Is there a way to find this information in the TFS UX, using an extension or querying the DB?


回答1:


You can find the owner of a query in Team Web by looking at the security of a query, but it doesn't show the create date.

The data you need is stored in the QueryItemstable of each collection db.

So, you should be able to get this information from a sql query like below, just change out the db names for your collection db.

SELECT t.Name as 'ProjectName'
      ,qi.[Name] as 'Query Name'
      ,[Text] 
      ,[CreateTime]
      ,[LastWriteTime]
      ,c.DisplayPart as 'Owner'
  FROM [TFS_DefaultCollection].[dbo].[QueryItems]qi 
  Left Join [TFS_DefaultCollection].[dbo].[Constants] c on c.TeamFoundationId=qi.OwnerIdentifier
  Left join [TFS_DefaultCollection].[dbo].[TreeNodes] t on t.ID=qi.ProjectId
  Where fPublic=1 and fFolder=0


来源:https://stackoverflow.com/questions/26193392/tfs-queries-how-to-determine-who-created-a-shared-query-and-when

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!