WIQL List Separator and the TFS Release Candidate

This past release of TFS brought us the much needed friendly names in the Team Foundation Client user drop down lists.  Before that change, your WIQL query may have looked like this:

<Wiql>
SELECT [System.Id], [System.Title]
FROM WorkItems WHERE [System.TeamProject] = @project
AND [System.AssignedTo] IN ('UserIdA', ''UserIdB')
ORDER BY [System.Id]
</Wiql>

As you can see we are searching for any Work Item assigned to UserIdA and UserIdB. The user list is delimited by a comma ( this will become important later ). After the release canidate release that same query may now look like the following:

<Wiql>
...
AND [System.AssignedTo] IN ('FirstNameUserA LastNameUserA', 'FirstNameUserB LastNameUserB')
...
</Wiql>

The only change to this query was the replacement of the alias with the users First Name Last Name. This query assumes your Active Directory is setup to display First Name Last Name rather than Last Name, First Name. If your Active Directory is setup like the latter then your query will look like:

<Wiql>
...
AND [System.AssignedTo] IN ('LastNameUserA, FirstNameUserA', 'LastNameUserB, FirstNameUserB')
...
</Wiql>

With that setup the name actually introduces a comma which invalidates the list separator. This query is now broken. All is not lost.

We can change the List Separator from a comma to a semi colon. Control Panel -> Regional and Language Options -> Customize, on the numbers tab and you will find the List Separator setting. Do realize this change may adversely effect other applications which may use the List Separator.

 

Your query will now change as follows:

<Wiql>
...
AND [System.AssignedTo] IN ('LastNameUserA, FirstNameUserA'; 'LastNameUserB, FirstNameUserB')
...
</Wiql>