Querying workitems vb.net

LoveToCode 161 Reputation points
2021-04-07T07:53:08.733+00:00

Hi, I’m looking to query all work items from devops. I’m successfully listing projects, but when I query there’s nothing. I’m using vb.net. Below is my code:

Hi, I’m looking to query all work items from devops. I’m successfully listing projects, but when I query there’s nothing. I’m using vb.net. Below is my code:

I’m calling the LoadworkitemsAsync function from Form_Load
Dim r = LoadworkitemsAsync(“testproject”)

Public Async Function LoadWorkItemsAsync(projectname As String) As Task(Of WorkItem)

    Dim credentials = New VssBasicCredential("", _Personalaccesstoken)
    Dim WQuery As New Wiql()

    With WQuery

        .Query = "select [System.ID], [System.Title],[System.Description]" _
              & " from Work Items Where[System.WorkItemType]='Epic' and" _
              & " [System.Teamproject]= " + "'" & projectname & "'"
    End With

    Dim WitClient As New WorkItemTrackingHttpClient(ADOUri, credentials)

'Here nothing happens it returns back to the function call
Dim wresults = Await WitClient.QueryByWiqlAsync(WQuery).ConfigureAwait(False)

VB
VB
An object-oriented programming language developed by Microsoft that is implemented on the .NET Framework. Previously known as Visual Basic .NET.
2,569 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Viorel 112.1K Reputation points
    2021-04-07T07:59:53.903+00:00

    Try "from WorkItems" instead of "from Work Items".

    Remove temporarily the "where..." condition to perform a simple test.