【问题标题】:Retrieving linked Work Items from Azure Devops, using WIQL使用 WIQL 从 Azure Devops 检索链接的工作项
【发布时间】:2020-06-29 23:15:07
【问题描述】:

我一直在研究使用 azure-devops python 包从 Azure Devops 检索工作项,并在以下提供的示例代码的帮助下设法拉下工作项:

https://github.com/microsoft/azure-devops-python-samples/blob/main/src/samples/work_item_tracking.py

但是,我正在尝试改进流程以获取特定工作项以及任何链接的“相关工作”项。 For instance, grabbing the parent, as well as "Test Feature"

我该怎么做呢?


编辑:

我已经更接近于构建此功能,但是我的查询不断返回每个工作项,而不仅仅是链接的项。我的目标是从树的根工作项中检索所有子项。

wiql = Wiql(
   query="""
            SELECT * FROM workitemLinks 
            WHERE (Source.[System.AreaPath] Under 'devOpsTesting\\testArea')
            AND ([System.Links.LinkType] = 'System.LinkTypes.Hierarchy-Forward')
            AND (Source.[System.Id] = 3)  
            ORDER BY [System.Id]
            MODE (Recursive, ReturnMatchingChildren)
        """
)

【问题讨论】:

    标签: python python-3.x azure-devops wiql


    【解决方案1】:

    我找到了我的问题的解决方案,从 MODE 中删除 'ReturnMatchingChildren' 摆脱了额外的回报。此解决方案假定项目 ID 为 3。

    wiql = Wiql(
       query="""
                SELECT * FROM workitemLinks 
                WHERE (Source.[System.AreaPath] Under 'devOpsTesting\\testArea')
                AND ([System.Links.LinkType] = 'System.LinkTypes.Hierarchy-Forward')
                AND (Source.[System.Id] = 3)  
                ORDER BY [System.Id]
                MODE (Recursive)
            """
    )
    

    【讨论】:

    • 感谢您在这里分享您的解决方案,请您接受您的解决方案as the answer?因此,对于遇到相同问题的其他成员轻松找到解决方案将很有帮助。祝你有美好的一天:)
    猜你喜欢
    • 1970-01-01
    • 2021-05-24
    • 1970-01-01
    • 2020-12-06
    • 1970-01-01
    • 2020-07-07
    • 2022-11-02
    • 2020-07-10
    • 2020-09-27
    相关资源
    最近更新 更多