Share via

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)

Developer technologies | VB

1 answer

Sort by: Most helpful
  1. Viorel 127K 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.

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.