|
1 |
| -using System; |
2 |
| -using System.Collections.Generic; |
3 |
| -using System.Linq; |
4 |
| -using System.Text; |
5 |
| -using System.Threading.Tasks; |
6 |
| -using Microsoft.TeamFoundation.WorkItemTracking.WebApi; |
| 1 | +using Microsoft.TeamFoundation.WorkItemTracking.WebApi; |
7 | 2 | using Microsoft.TeamFoundation.WorkItemTracking.WebApi.Models;
|
8 | 3 | using Microsoft.VisualStudio.Services.Client;
|
9 | 4 | using Microsoft.VisualStudio.Services.Common;
|
10 | 5 | using Microsoft.VisualStudio.Services.WebApi;
|
| 6 | +using System; |
| 7 | +using System.Linq; |
11 | 8 |
|
12 | 9 | namespace ClientLibraryConsoleAppSample
|
13 | 10 | {
|
14 | 11 | class Program
|
15 | 12 | {
|
16 | 13 | //============= Config [Edit these with your settings] =====================
|
17 |
| - internal const string vstsCollectionUrl = "http://myaccount.visualstudio.com"; //change to the URL of your VSTS account |
| 14 | + internal const string vstsCollectionUrl = "https://myaccount.visualstudio.com"; //change to the URL of your VSTS account; NOTE: This must use HTTPS |
18 | 15 | // internal const string vstsCollectioUrl = "http://myserver:8080/tfs/DefaultCollection" alternate URL for a TFS collection
|
19 | 16 | //==========================================================================
|
20 | 17 |
|
21 | 18 | //Console application to execute a user defined work item query
|
22 | 19 | static void Main(string[] args)
|
23 | 20 | {
|
24 |
| - //Prompt user for credential for collection specified above |
25 |
| - VssCredentials cred = new VssClientCredentials(false); |
26 |
| - cred.PromptType = CredentialPromptType.PromptIfNeeded; |
27 |
| - VssConnection connection = new VssConnection(new Uri(vstsCollectionUrl), cred); |
| 21 | + //Prompt user for credential |
| 22 | + VssConnection connection = new VssConnection(new Uri(vstsCollectionUrl), new VssClientCredentials()); |
28 | 23 |
|
29 | 24 | //create http client and query for resutls
|
30 | 25 | WorkItemTrackingHttpClient witClient = connection.GetClient<WorkItemTrackingHttpClient>();
|
31 |
| - Wiql query = new Wiql() { Query = "Select [State], [Title] from WorkItems where [Work Item Type] = 'Bug' And [Tags] Contains 'findMe'" }; |
| 26 | + Wiql query = new Wiql() { Query = "SELECT [Id], [Title], [State] FROM workitems WHERE [Work Item Type] = 'Bug' AND [Assigned To] = @Me" }; |
32 | 27 | WorkItemQueryResult queryResults = witClient.QueryByWiqlAsync(query).Result;
|
33 | 28 |
|
34 | 29 | //Display reults in console
|
|
0 commit comments