This repository has been archived by the owner on Oct 4, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 509
/
ProcessesSample.cs
46 lines (36 loc) · 1.57 KB
/
ProcessesSample.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
37
38
39
40
41
42
43
44
45
46
using Microsoft.TeamFoundation.Core.WebApi;
using Microsoft.VisualStudio.Services.WebApi;
using System;
using System.Collections.Generic;
namespace Microsoft.Azure.DevOps.ClientSamples.ProjectsAndTeams
{
[ClientSample(CoreConstants.AreaName, CoreConstants.ProcessesRouteName)]
public class ProcessesSample : ClientSample
{
[ClientSampleMethod]
public List<Process> ListProcesses()
{
VssConnection connection = Context.Connection;
ProcessHttpClient processClient = connection.GetClient<ProcessHttpClient>();
List<Process> processes = processClient.GetProcessesAsync().Result;
foreach(var process in processes)
{
Console.WriteLine("{0} {1} {2}", (process.IsDefault ? "*" : " "), process.Name.PadRight(12), process.Id);
}
return processes;
}
[ClientSampleMethod]
public Process GetProcess()
{
Guid scrumProcessId = Guid.Parse("adcc42ab-9882-485e-a3ed-7678f01f66bc");
VssConnection connection = Context.Connection;
ProcessHttpClient processClient = connection.GetClient<ProcessHttpClient>();
Process process = processClient.GetProcessByIdAsync(scrumProcessId).Result;
Console.WriteLine("Name: {0}", process.Name);
Console.WriteLine("Default?: {0}", process.IsDefault);
Console.WriteLine("Type: {0}", process.Type);
Console.WriteLine("Description:\n{0}", process.Description);
return process;
}
}
}