2

I am building an email report about VSTS work items where I have some links that should open VSTS queries. The WIQL query is passed as part of the hyperlink URL, see the following link:

Define a query as a hyperlink

I pass the DateTime as date and time ([System.CreatedDate] >= '2019-02-18T08:00:00.0000000Z') not only date. The page that opens has the following error

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'».

I tried to add ?timePrecision=true at the end of the URL but it doesn't help.

Any idea how can I use WIQL in hyperlink and pass date & time?

Nicolae Daian
  • 1,065
  • 3
  • 18
  • 39

2 Answers2

1

Query as a hyperlink doesn't support timePrecision yet. You need to use rest api Wiql - Query By Wiql to use time precision, for example:

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'"
}

Meanwhile, you could submit a suggestion at the website below to suggest supporting timePrecision when define a Query as a hyperlink:

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

Cece Dong - MSFT
  • 29,631
  • 1
  • 24
  • 39
0

As Pointed out by Abdul Rahman Kayali in the comments, when using the WIQL API Resource, it is possible to supply the timePrecision=true optional parameter which enables the time precision.

For example:

POST https://dev.azure.com/fabrikam/_apis/wit/wiql?timePrecision=true&api-version=7.0
Chedy2149
  • 2,821
  • 4
  • 33
  • 56