-
Notifications
You must be signed in to change notification settings - Fork 307
/
Copy pathProgram.cs
36 lines (33 loc) · 1.57 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
using System;
using Microsoft.VisualStudio.Services.Client;
using Microsoft.VisualStudio.Services.WebApi;
using Microsoft.TeamFoundation.Core.WebApi;
using System.Collections.Generic;
namespace DualSupportClientSample
{
//After running the console will close so please add a breakpoint or sleep to see output.
class Program
{
//============= Config [Edit these with your settings] =====================
internal const string azureDevOpsOrganizationUrl = "https://dev.azure.com/organization"; //change to the URL of your Azure DevOps or TFS account; Azure DevOps: https://dev.azure.com/organization TFS: https://*:8080/tfs/defaultcollection"
//==========================================================================
public static void Main(string[] args)
{
try
{
//Based on collection URL will either start an interactive login session or use local Windows credential authentication
VssConnection connection = new VssConnection(new Uri(azureDevOpsOrganizationUrl), new VssClientCredentials());
ProjectHttpClient projectClient = connection.GetClient<ProjectHttpClient>();
IEnumerable<TeamProjectReference> projects = projectClient.GetProjects().Result;
foreach (TeamProjectReference p in projects)
{
Console.WriteLine(p.Name);
}
}
catch (Exception ex)
{
Console.WriteLine("{0}: {1}", ex.GetType(), ex.Message);
}
}
}
}