TFS2015 - 显示所有共享和用户拥有的通知及其所有者

TFS2015 - Display all shared and user owned notifications and their owners

我正在尝试编写一个 SQL 查询,该查询将在 TFS 2015 On-Premise 上的更改通知上列出所有共享和用户拥有的 VSTS。根据我的研究,通知应该存储在 tbl_EventSubscription table 中,但是那里没有关于事件是用户拥有还是共享的信息,只有订阅者的订阅 ID 而我没有知道在哪里寻找主人。

如果有可能用 REST API 解决这个问题,它也会有所帮助。

任何帮助或指导将不胜感激。

不建议您直接深入 TFS 数据库。不要对 TFS 数据库进行任何更改,否则您可能会失去 Microsoft 的支持。

由于您已经获得了 SubscriptionID,要找出隐藏在 "SubscriberId" 列中的 GUID 后面的用户身份,您可以使用以下 SQL 语句:

SELECT  es.Id, 
        es.EventType, 
        es.Expression, 
        sic.mail_address, 
        sic.computed_display_name 
FROM    tbl_EventSubscription es 
JOIN    [Tfs_Configuration].[dbo].tbl_security_identity_cache sic 
ON      sic.tf_id = es.SubscriberId 
WHERE   es.Id = 123

更多详情请看这篇博文:Who created that TFS event subscription?

好的,我想我明白了:

   SELECT Notif.Id AS 'Notification Id',
          Notif.EventType AS 'Event Type',
          Notif.Classification AS 'Notification Classification',
          Const.IdentityDisplayName AS 'Notification Owner'
     FROM [Tfs_Development].[dbo].[tbl_EventSubscription] Notif
LEFT JOIN [Tfs_Development].[dbo].[Constants] Const ON Const.TeamFoundationId = Notif.SubscriberId
 ORDER BY Notif.Id

@PatrickLu-MSFT 我不知道为什么,但我在 Tfs_Configuration 中没有 tbl_security_identity_cache,但我在 Tfs_Development 中有它并且它是空的。我使用 Tfs_Configuration.dbo.tbl_Identity 作为用户名的参考,但它没有 return 我的团队订阅者甚至一些用户的名字,所以最后我将采用我的解决方案。

感谢您的帮助。