【问题标题】:How to specify "date precision" when querying VSTS through a hyperlink通过超链接查询 VSTS 时如何指定“日期精度”
【发布时间】:2019-02-19 16:26:27
【问题描述】:

我正在构建一个关于 VSTS 工作项的电子邮件报告,其中我有一些应该打开 VSTS 查询的链接。 WIQL 查询作为超链接 URL 的一部分传递,请参见以下链接:

Define a query as a hyperlink

我将 DateTime 作为日期和时间 ([System.CreatedDate] >= '2019-02-18T08:00:00.0000000Z') 传递,而不仅仅是日期。打开的页面出现如下错误

You cannot supply a time with the date when running a query using date precision. The error is caused by «[System.CreatedDate] >= '2019-02-18T08:00:00.0000000Z'».

我尝试在 URL 末尾添加?timePrecision=true,但没有帮助。

知道如何在超链接中使用 WIQL 并传递日期和时间吗?

【问题讨论】:

    标签: azure-devops azure-devops-rest-api wiql


    【解决方案1】:

    查询作为超链接还不支持timePrecision。您需要使用rest api Wiql - Query By Wiql 来使用时间精度,例如:

    POST https://dev.azure.com/{organization}/{project}/{team}/_apis/wit/wiql?timePrecision=true&api-version=5.0
    
    {
    "query": "SELECT [System.ID], [System.Title], [System.State] FROM WorkItems WHERE [System.TeamProject]='xxxx' AND [System.CreatedDate]>='2019-01-25 11:00 AM'"
    }
    

    同时,您可以在以下网站提交建议,建议在将查询定义为超链接时支持timePrecision

    https://developercommunity.visualstudio.com/content/idea/post.html?space=21

    【讨论】:

    • 我无法使用 REST API,因为这是网页上的链接。我最终将查询更改为不使用小时而是整天
    猜你喜欢
    • 1970-01-01
    • 2016-01-18
    • 2021-08-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-04-21
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多