зеркало из
1
0
Форкнуть 0
This commit is contained in:
Will Smythe 2017-03-22 00:09:58 -04:00
Родитель f637a3253e
Коммит 7b9502eb47
30 изменённых файлов: 532 добавлений и 288 удалений

Просмотреть файл

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

Просмотреть файл

@ -0,0 +1,74 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{0CDA3AB5-3C7A-43D2-875C-66ED734CF864}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>Vsts.ClientSamples.Runner</RootNamespace>
<AssemblyName>Vsts.ClientSamples.Runner</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.TeamFoundation.Common, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.VisualStudio.Services.Client.15.113.0-preview\lib\net45\Microsoft.TeamFoundation.Common.dll</HintPath>
</Reference>
<Reference Include="Microsoft.VisualStudio.Services.Common, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.VisualStudio.Services.Client.15.113.0-preview\lib\net45\Microsoft.VisualStudio.Services.Common.dll</HintPath>
</Reference>
<Reference Include="Microsoft.VisualStudio.Services.WebApi, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.VisualStudio.Services.Client.15.113.0-preview\lib\net45\Microsoft.VisualStudio.Services.WebApi.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Net.Http.Formatting, Version=5.2.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNet.WebApi.Client.5.2.2\lib\net45\System.Net.Http.Formatting.dll</HintPath>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ClientSamples\ClientSamples.csproj">
<Project>{545851e1-9bd9-4939-8af4-9a8910cf5c34}</Project>
<Name>ClientSamples</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

Просмотреть файл

@ -0,0 +1,121 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace Vsts.ClientSamples.Runner
{
public class ClientSampleProgram
{
public static int Main(string[] args)
{
if (args.Length == 0)
{
ShowUsage();
return 0;
}
Uri connectionUrl;
string area, resource;
try
{
CheckArguments(args, out connectionUrl, out area, out resource);
}
catch (ArgumentException ex)
{
Console.WriteLine(ex.Message);
return -1;
}
Dictionary<ClientSample,IEnumerable<RunnableClientSampleMethod>> runnableMethodsBySample = ClientSampleUtils.GetRunnableMethods(area, resource);
if (runnableMethodsBySample.Any())
{
ClientSampleContext context = new ClientSampleContext(connectionUrl);
foreach (var item in runnableMethodsBySample)
{
ClientSample clientSample = item.Key;
clientSample.Context = context;
foreach (var runnableMethod in item.Value)
{
try
{
context.Log("Running client sample {0}/{1}/{2}:", runnableMethod.Area, runnableMethod.Resource, runnableMethod.MethodBase.Name);
context.Log("");
runnableMethod.MethodBase.Invoke(clientSample, null);
}
catch (Exception ex)
{
context.Log(" Excception during run: " + ex.Message);
}
finally
{
context.Log("--------------------------------------");
context.Log("");
}
}
}
}
return 0;
}
private static void CheckArguments(string[] args, out Uri connectionUrl, out string area, out string resource)
{
try
{
connectionUrl = new Uri(args[0]);
}
catch (Exception)
{
throw new ArgumentException("Invalid URL");
}
if (args.Length > 1)
{
area = args[1];
//if (!IsValidArea(area))
//{
// throw new ArgumentException("Invalid area. Supported areas: {0}.", String.Join(", ", GetSupportedAreas()));
//}
if (args.Length > 2)
{
resource = args[2];
// if (!IsValidResource(area, resource))
// {
// throw new ArgumentException("Invalid resource. Supported resources for {0}: {1}.", area, String.Join(", ", GetSupportedAreas()));
// }
}
else
{
resource = null;
}
}
else
{
area = null;
resource = null;
}
}
private static void ShowUsage() {
Console.WriteLine("Runs the client samples on a Team Services account or Team Foundation Server instance.");
Console.WriteLine("");
Console.WriteLine("WARNING: Some samples are destructive. Always run on a test account or collection.");
Console.WriteLine("");
Console.WriteLine("Usage: ClientSampleProgram url [area [resource]]");
Console.WriteLine("");
Console.WriteLine(" url URL for the account or collection to run the samples on");
Console.WriteLine(" Example: https://fabrikam.visualstudio.com");
Console.WriteLine(" area Run only samples for this area, otherwise run the samples for all areas.");
Console.WriteLine(" resource Run only samples for this resource, otherwise run the samples for all resources under this area (or all areas).");
Console.WriteLine("");
}
}
}

Просмотреть файл

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("ClientSamples.Runner")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ClientSamples.Runner")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("0cda3ab5-3c7a-43d2-875c-66ed734cf864")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

Просмотреть файл

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.AspNet.WebApi.Client" version="5.2.2" targetFramework="net452" />
<package id="Microsoft.VisualStudio.Services.Client" version="15.113.0-preview" targetFramework="net452" />
<package id="Newtonsoft.Json" version="8.0.3" targetFramework="net452" />
</packages>

Просмотреть файл

@ -2,11 +2,11 @@
using System.Text;
using System.Collections.Generic;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using VstsSamples.Client.Tests.Integration;
using VstsSamples.Client.Notification;
using Vsts.ClientSamples.Tests.Integration;
using Vsts.ClientSamples.Notification;
using Microsoft.VisualStudio.Services.Notifications.WebApi;
namespace VstsSamples.Client.Tests.Integration.Notification
namespace Vsts.ClientSamples.Tests.Integration.Notification
{
[TestClass]
public class SubscriptionTests : TestBase<SubscriptionsSample>

Просмотреть файл

@ -8,7 +8,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VstsSamples.Client.Tests.Integration
namespace Vsts.ClientSamples.Tests.Integration
{
public class TestBase<T> where T : ClientSample, new()
{
@ -51,10 +51,10 @@ namespace VstsSamples.Client.Tests.Integration
string userName = TestContext.Properties["password"] as string;
string password = TestContext.Properties["password"] as string;
ClientSampleConfiguration configuration = new ClientSampleConfiguration(new Uri(connectionUrl), new VssBasicCredential(userName, password));
ClientSampleContext context = new ClientSampleContext(new Uri(connectionUrl), new VssBasicCredential(userName, password));
ClientSample = new T();
ClientSample.Configuration = configuration;
ClientSample.Context = configuration;
}
protected Guid GetCurrentUserId()

Просмотреть файл

@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26223.1
VisualStudioVersion = 15.0.26228.9
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClientSamples", "ClientSamples\ClientSamples.csproj", "{545851E1-9BD9-4939-8AF4-9A8910CF5C34}"
EndProject
@ -12,6 +12,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
README.md = README.md
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClientSamples.Runner", "ClientSamples.Runner\ClientSamples.Runner.csproj", "{0CDA3AB5-3C7A-43D2-875C-66ED734CF864}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -26,6 +28,10 @@ Global
{AAA30379-02BF-447C-829C-225E2D2B1069}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AAA30379-02BF-447C-829C-225E2D2B1069}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AAA30379-02BF-447C-829C-225E2D2B1069}.Release|Any CPU.Build.0 = Release|Any CPU
{0CDA3AB5-3C7A-43D2-875C-66ED734CF864}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0CDA3AB5-3C7A-43D2-875C-66ED734CF864}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0CDA3AB5-3C7A-43D2-875C-66ED734CF864}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0CDA3AB5-3C7A-43D2-875C-66ED734CF864}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

Просмотреть файл

@ -9,7 +9,7 @@ using System.Linq;
using System.Net.Http;
using AadAuthenticationContext = Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationContext;
namespace VstsSamples.Client.Auth
namespace Vsts.ClientSamples.Auth
{
public class InteractiveAuthSample
{
@ -23,7 +23,7 @@ namespace VstsSamples.Client.Auth
// https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-protocols-oauth-code
internal const string RedirectUri = "urn:ietf:wg:oauth:2.0:oob";
public Authentication()
public InteractiveAuthSample()
{
}

Просмотреть файл

@ -6,19 +6,19 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VstsSamples.Client.Build
namespace Vsts.ClientSamples.Build
{
[ClientSample]
public class BuildsSample : ClientSample
{
public BuildsSample(ClientSampleConfiguration configuration) : base(configuration)
public BuildsSample(ClientSampleContext context) : base(context)
{
}
[ClientSampleMethod]
public IEnumerable<BuildDefinitionReference> ListBuildDefinitions(string projectName = null)
{
VssConnection connection = this.Connection;
VssConnection connection = Context.Connection;
BuildHttpClient buildClient = connection.GetClient<BuildHttpClient>();
return buildClient.GetDefinitionsAsync2(project: projectName).Result;

Просмотреть файл

@ -1,64 +1,27 @@
using System;
using System.Reflection;
using System.Collections.Generic;
using System.ComponentModel.Composition.Hosting;
using System.ComponentModel.Composition;
using Microsoft.VisualStudio.Services.WebApi;
using System.Net.Http;
using Microsoft.VisualStudio.Services.Common;
namespace VstsSamples.Client
namespace Vsts.ClientSamples
{
/// <summary>
/// Base class that all client samples extend from.
/// </summary>
public abstract class ClientSample
{
public ClientSampleConfiguration Configuration { get; set; }
private VssConnection _connection;
public VssConnection Connection
{
get
{
if (_connection == null)
{
ClientSampleHttpLogger loggerHandler = new ClientSampleHttpLogger();
VssHttpMessageHandler vssHandler = new VssHttpMessageHandler(Configuration.Credentials, VssClientHttpRequestSettings.Default.Clone());
_connection = new VssConnection(Configuration.Url, vssHandler, new DelegatingHandler[] { loggerHandler });
}
return this._connection;
}
private set
{
_connection = value;
}
}
public ClientSampleContext Context { get; set; }
[ImportingConstructor]
public ClientSample()
public ClientSample(): this(null)
{
}
public ClientSample(ClientSampleConfiguration configuration)
public ClientSample(ClientSampleContext context)
{
this.Configuration = configuration;
this.Context = context;
}
protected void Log(String message)
{
this.Log(message, null);
}
protected void Log(String message, params object[] args)
{
System.Console.WriteLine(message, args);
}
}
/// <summary>
@ -119,8 +82,4 @@ namespace VstsSamples.Client
this.Operation = operation;
}
}
}

Просмотреть файл

@ -1,62 +0,0 @@
using System;
using System.Collections.Generic;
using Microsoft.VisualStudio.Services.Common;
namespace VstsSamples.Client
{
/// <summary>
/// Configuration data for client samples. Includes the target URL, credentials, and any other properties.
/// </summary>
public class ClientSampleConfiguration
{
public VssCredentials Credentials { get; private set; }
public Uri Url { get; private set; }
protected Dictionary<String, Object> Properties { get; set; } = new Dictionary<String, Object>();
public ClientSampleConfiguration(Uri url): this(url, new VssCredentials())
{
}
public ClientSampleConfiguration(Uri url, VssCredentials credentials)
{
this.Url = url;
this.Credentials = credentials;
}
public T Get<T>(string name, T defaultValueIfMissing)
{
T result;
if (Properties.TryGetValue<T>(name, out result))
{
return result;
}
else
{
return defaultValueIfMissing;
}
}
public void Set<T>(string name, T value)
{
Properties[name] = value;
}
/// <summary>
/// Creates a new client sample configuration from the supplied Team Services account name and personal access token.
/// </summary>
/// <param name="accountName"></param>
/// <param name="personalAccessToken"></param>
/// <returns></returns>
public static ClientSampleConfiguration NewInstanceFromAccountName(string accountName, string personalAccessToken)
{
return new ClientSampleConfiguration(
new Uri(String.Format(s_accountUrlPattern, accountName)),
new VssBasicCredential("pat", personalAccessToken));
}
private static readonly string s_accountUrlPattern = "http://{0}.visualstudio.com";
}
}

Просмотреть файл

@ -0,0 +1,108 @@
using System;
using System.Collections.Generic;
using Microsoft.VisualStudio.Services.Common;
using Microsoft.VisualStudio.Services.WebApi;
using System.Net.Http;
namespace Vsts.ClientSamples
{
/// <summary>
/// Configuration data for client samples. Includes the target URL, credentials, and any other properties.
/// </summary>
public class ClientSampleContext
{
protected VssCredentials Credentials { get; private set; }
protected Uri Url { get; private set; }
protected Dictionary<String, Object> Properties { get; set; } = new Dictionary<String, Object>();
private VssConnection _connection;
public VssConnection Connection
{
get
{
if (_connection == null)
{
ClientSampleHttpLogger loggerHandler = new ClientSampleHttpLogger();
VssHttpMessageHandler vssHandler = new VssHttpMessageHandler(
Credentials,
VssClientHttpRequestSettings.Default.Clone());
_connection = new VssConnection(
Url,
vssHandler,
new DelegatingHandler[] { loggerHandler });
}
return this._connection;
}
private set
{
_connection = value;
}
}
public ClientSampleContext(Uri url)
{
this.Url = url;
this.Credentials = new VssCredentials();
}
public ClientSampleContext(Uri url, VssCredentials credentials)
{
this.Url = url;
this.Credentials = credentials;
}
public ClientSampleContext(VssConnection connection)
{
this.Connection = connection;
}
public T Get<T>(string name, T defaultValueIfMissing)
{
T result;
if (Properties.TryGetValue<T>(name, out result))
{
return result;
}
else
{
return defaultValueIfMissing;
}
}
public void Set<T>(string name, T value)
{
Properties[name] = value;
}
public void Log(String message)
{
this.Log(message, null);
}
public void Log(String message, params object[] args)
{
System.Console.WriteLine(message, args);
}
/// <summary>
/// Creates a new client sample configuration from the supplied Team Services account name and personal access token.
/// </summary>
/// <param name="accountName"></param>
/// <param name="personalAccessToken"></param>
/// <returns></returns>
public static ClientSampleContext NewInstanceFromAccountName(string accountName, string personalAccessToken)
{
return new ClientSampleContext(
new Uri(String.Format(s_accountUrlPattern, accountName)),
new VssBasicCredential("pat", personalAccessToken));
}
private static readonly string s_accountUrlPattern = "http://{0}.visualstudio.com";
}
}

Просмотреть файл

@ -2,25 +2,15 @@ using System;
using System.Reflection;
using System.Collections.Generic;
using System.ComponentModel.Composition.Hosting;
using System.ComponentModel.Composition;
using Microsoft.VisualStudio.Services.WebApi;
using System.Net.Http;
using Microsoft.VisualStudio.Services.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
using System.Linq;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
using Newtonsoft.Json.Linq;
using System.Diagnostics;
using System.Reflection;
namespace VstsSamples.Client
namespace Vsts.ClientSamples
{
/// <summary>
@ -60,10 +50,9 @@ namespace VstsSamples.Client
if (!string.IsNullOrEmpty(ma.Area) && !string.IsNullOrEmpty(ma.Resource) && !string.IsNullOrEmpty(ma.Operation))
{
RunnableClientSampleMethod r = new RunnableClientSampleMethod();
r.Instance = cs.Value;
r.Method = m;
r.MethodBase = m;
r.Area = ma.Area;
r.Resource = ma.Resorce;
r.Resource = ma.Resource;
runnableMethods.Add(r);
}
@ -87,7 +76,6 @@ namespace VstsSamples.Client
}
}
return results;
}
}
@ -203,9 +191,7 @@ namespace VstsSamples.Client
public Dictionary<String, String> ResponseHeaders;
[DataMember(EmitDefaultValue = false)]
public Object ResponseBody;
public Object ResponseBody;
}
}

Просмотреть файл

@ -7,8 +7,8 @@
<ProjectGuid>{545851E1-9BD9-4939-8AF4-9A8910CF5C34}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>VstsSamples.Client</RootNamespace>
<AssemblyName>VstsSamples.Client</AssemblyName>
<RootNamespace>Vsts.ClientSamples</RootNamespace>
<AssemblyName>Vsts.ClientSamples</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
@ -115,14 +115,13 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Auth\*.cs" />
<Compile Include="Build\BuildsSample.cs" />
<Compile Include="ClientSample.cs" />
<Compile Include="ClientSampleAttributes.cs" />
<Compile Include="ClientSampleConfiguration.cs" />
<Compile Include="ClientSampleHttpLogger.cs" />
<Compile Include="AuthenticationSample.cs" />
<Compile Include="ClientSampleContext.cs" />
<Compile Include="ClientSampleUtils.cs" />
<Compile Include="Core\*.cs" />
<Compile Include="Notification\*.cs" />
<Compile Include="ProjectsAndTeams\*.cs" />
<Compile Include="WorkItemTracking\AttachmentsSample.cs" />
<Compile Include="WorkItemTracking\BatchSample.cs" />
<Compile Include="WorkItemTracking\ClassificationNodesSample.cs" />

Просмотреть файл

@ -3,19 +3,19 @@ using Microsoft.VisualStudio.Services.WebApi;
using System;
using System.Collections.Generic;
namespace VstsSamples.Client.Core
namespace Vsts.ClientSamples.Core
{
[ClientSample(CoreConstants.AreaName, CoreConstants.ProcessesRouteName)]
public class ProcessesSample : ClientSample
{
public ProcessesSample(ClientSampleConfiguration configuration) : base(configuration)
public ProcessesSample(ClientSampleContext context) : base(context)
{
}
[ClientSampleMethod]
public List<Process> GetProcesses()
{
VssConnection connection = this.Connection;
VssConnection connection = Context.Connection;
ProcessHttpClient processClient = connection.GetClient<ProcessHttpClient>();
List<Process> processes = processClient.GetProcessesAsync().Result;
@ -26,7 +26,7 @@ namespace VstsSamples.Client.Core
[ClientSampleMethod]
public Process GetProcess(System.Guid processId)
{
VssConnection connection = this.Connection;
VssConnection connection = Context.Connection;
ProcessHttpClient processClient = connection.GetClient<ProcessHttpClient>();
Process process = processClient.GetProcessByIdAsync(processId).Result;

Просмотреть файл

@ -3,14 +3,14 @@ using Microsoft.VisualStudio.Services.Common;
using Microsoft.VisualStudio.Services.WebApi;
using System;
using System.Collections.Generic;
using VstsSamples.Client;
using Vsts.ClientSamples;
namespace VstsSamples.Client.Core
namespace Vsts.ClientSamples.Core
{
[ClientSample(CoreConstants.AreaName, CoreConstants.ProjectCollectionsResource)]
public class ProjectCollectionsSample : ClientSample
{
public ProjectCollectionsSample(ClientSampleConfiguration configuration) : base(configuration)
public ProjectCollectionsSample(ClientSampleContext context) : base(context)
{
}
@ -18,7 +18,7 @@ namespace VstsSamples.Client.Core
public IEnumerable<TeamProjectCollectionReference> GetProjectCollections()
{
// Create instance of VssConnection using passed credentials
VssConnection connection = this.Connection;
VssConnection connection = Context.Connection;
ProjectCollectionHttpClient projectCollectionClient = connection.GetClient<ProjectCollectionHttpClient>();
IEnumerable<TeamProjectCollectionReference> projectCollections = projectCollectionClient.GetProjectCollections().Result;
@ -29,7 +29,7 @@ namespace VstsSamples.Client.Core
[ClientSampleMethod]
public TeamProjectCollectionReference GetProjectCollection(string collectionName)
{
VssConnection connection = this.Connection;
VssConnection connection = Context.Connection;
ProjectCollectionHttpClient projectCollectionClient = connection.GetClient<ProjectCollectionHttpClient>();
TeamProjectCollectionReference teamProjectCollectionReference = projectCollectionClient.GetProjectCollection(collectionName).Result;

Просмотреть файл

@ -5,12 +5,12 @@ using Microsoft.VisualStudio.Services.WebApi;
using System;
using System.Collections.Generic;
namespace VstsSamples.Client.Core
namespace Vsts.ClientSamples.Core
{
[ClientSample(CoreConstants.AreaName, CoreConstants.ProjectsRouteName)]
public class ProjectsSample: ClientSample
{
public ProjectsSample(ClientSampleConfiguration configuration) : base(configuration)
public ProjectsSample(ClientSampleContext context) : base(context)
{
}
@ -21,7 +21,7 @@ namespace VstsSamples.Client.Core
[ClientSampleMethod]
public void ListAllProjectsAndTeams()
{
VssConnection connection = this.Connection;
VssConnection connection = Context.Connection;
ProjectHttpClient projectClient = connection.GetClient<ProjectHttpClient>();
TeamHttpClient teamClient = connection.GetClient<TeamHttpClient>();
@ -29,13 +29,13 @@ namespace VstsSamples.Client.Core
foreach(var project in projects)
{
Log("Teams for project {0}:", project.Name);
Log("--------------------------------------------------");
Context.Log("Teams for project {0}:", project.Name);
Context.Log("--------------------------------------------------");
IEnumerable<WebApiTeam> teams = teamClient.GetTeamsAsync(project.Name).Result;
foreach (var team in teams)
{
Log(" {0}: {1}", team.Name, team.Description);
Context.Log(" {0}: {1}", team.Name, team.Description);
}
}
}
@ -48,7 +48,7 @@ namespace VstsSamples.Client.Core
[ClientSampleMethod]
public IEnumerable<TeamProjectReference> GetProjectsByState(ProjectState state = ProjectState.All)
{
VssConnection connection = this.Connection;
VssConnection connection = Context.Connection;
ProjectHttpClient projectClient = connection.GetClient<ProjectHttpClient>();
IEnumerable<TeamProjectReference> projects = projectClient.GetProjects(state).Result;
@ -59,7 +59,7 @@ namespace VstsSamples.Client.Core
[ClientSampleMethod]
public TeamProjectReference GetProjectDetails(string projectName = "Fabrikam")
{
VssConnection connection = this.Connection;
VssConnection connection = Context.Connection;
ProjectHttpClient projectClient = connection.GetClient<ProjectHttpClient>();
TeamProject project = projectClient.GetProject(projectName, includeCapabilities: true, includeHistory: true).Result;
@ -77,7 +77,7 @@ namespace VstsSamples.Client.Core
SourceControlTypes.Git.ToString();
// Setup process properties
ProcessHttpClient processClient = this.Connection.GetClient<ProcessHttpClient>();
ProcessHttpClient processClient = Context.Connection.GetClient<ProcessHttpClient>();
Guid processId = processClient.GetProcessesAsync().Result.Find(process => { return process.Name.Equals(processName, StringComparison.InvariantCultureIgnoreCase); }).Id;
Dictionary<string, string> processProperaties = new Dictionary<string, string>();
@ -100,7 +100,7 @@ namespace VstsSamples.Client.Core
Capabilities = capabilities
};
VssConnection connection = this.Connection;
VssConnection connection = Context.Connection;
ProjectHttpClient projectClient = connection.GetClient<ProjectHttpClient>();
OperationReference createProjectOperationStatus = projectClient.QueueCreateProject(projectCreateParameters).Result;
@ -112,7 +112,7 @@ namespace VstsSamples.Client.Core
public OperationReference GetOperationStatus(Guid operationId)
{
VssConnection connection = this.Connection;
VssConnection connection = Context.Connection;
OperationsHttpClient operationsClient = connection.GetClient<OperationsHttpClient>();
OperationReference operationStatus = operationsClient.GetOperation(operationId).Result;
@ -123,7 +123,7 @@ namespace VstsSamples.Client.Core
[ClientSampleMethod]
public OperationReference RenameProject(String currentName = "Fabrikam", string newName = "Fabrikam (renamed)")
{
VssConnection connection = this.Connection;
VssConnection connection = Context.Connection;
ProjectHttpClient projectClient = connection.GetClient<ProjectHttpClient>();
Guid projectId = projectClient.GetProject(currentName).Result.Id;
@ -146,7 +146,7 @@ namespace VstsSamples.Client.Core
Description = newDescription
};
VssConnection connection = this.Connection;
VssConnection connection = Context.Connection;
ProjectHttpClient projectClient = connection.GetClient<ProjectHttpClient>();
Guid projectId = projectClient.GetProject(projectName).Result.Id;
@ -158,7 +158,7 @@ namespace VstsSamples.Client.Core
public OperationReference DeleteTeamProject(Guid projectId)
{
VssConnection connection = this.Connection;
VssConnection connection = Context.Connection;
ProjectHttpClient projectClient = connection.GetClient<ProjectHttpClient>();
OperationReference operationStatus = projectClient.QueueDeleteProject(projectId).Result;

Просмотреть файл

@ -4,19 +4,19 @@ using System;
using System.Collections.Generic;
using System.Linq;
namespace VstsSamples.Client.Core
namespace Vsts.ClientSamples.Core
{
[ClientSample(CoreConstants.AreaName, CoreConstants.TeamsResource)]
public class TeamsSample : ClientSample
{
public TeamsSample(ClientSampleConfiguration configuration) : base(configuration)
public TeamsSample(ClientSampleContext context) : base(context)
{
}
[ClientSampleMethod]
public IEnumerable<WebApiTeam> GetOrderedTeamsList(string projectName = "Fabrikam")
{
VssConnection connection = this.Connection;
VssConnection connection = Context.Connection;
TeamHttpClient teamClient = connection.GetClient<TeamHttpClient>();
IEnumerable<WebApiTeam> teams = teamClient.GetTeamsAsync(projectName).Result;
@ -29,7 +29,7 @@ namespace VstsSamples.Client.Core
[ClientSampleMethod]
public WebApiTeam GetTeam(string projectName, string teamName)
{
VssConnection connection = this.Connection;
VssConnection connection = Context.Connection;
TeamHttpClient teamClient = connection.GetClient<TeamHttpClient>();
WebApiTeam team = teamClient.GetTeamAsync(projectName, teamName).Result;
@ -40,7 +40,7 @@ namespace VstsSamples.Client.Core
[ClientSampleMethod(resource:CoreConstants.TeamMembersResource)]
public IEnumerable<IdentityRef> GetTeamMembers(string projectName, string teamName)
{
VssConnection connection = this.Connection;
VssConnection connection = Context.Connection;
TeamHttpClient teamClient = connection.GetClient<TeamHttpClient>();
IEnumerable<IdentityRef> results = teamClient.GetTeamMembersAsync(projectName, teamName).Result;
@ -51,7 +51,7 @@ namespace VstsSamples.Client.Core
[ClientSampleMethod]
public WebApiTeam CreateTeam(string projectName = "Fabikam", string name = "Fabrikam Ops Team", string description = "Team focused on operations for Fabrikam")
{
VssConnection connection = this.Connection;
VssConnection connection = Context.Connection;
TeamHttpClient teamClient = connection.GetClient<TeamHttpClient>();
WebApiTeam newTeamCreateParameters = new WebApiTeam()
@ -68,7 +68,7 @@ namespace VstsSamples.Client.Core
[ClientSampleMethod]
public WebApiTeam RenameTeam(string projectName = "Fabrikam", string currentTeamName = "Fabrikam Ops Team", string newTeamName = "Fabrikam Ops Team (renamed)")
{
VssConnection connection = this.Connection;
VssConnection connection = Context.Connection;
TeamHttpClient teamClient = connection.GetClient<TeamHttpClient>();
WebApiTeam teamUpdateParameters = new WebApiTeam()
@ -84,7 +84,7 @@ namespace VstsSamples.Client.Core
[ClientSampleMethod]
public bool DeleteTeam(string projectName = "Fabrikam", string teamName = "Fabrikam Ops Team")
{
VssConnection connection = this.Connection;
VssConnection connection = Context.Connection;
TeamHttpClient teamClient = connection.GetClient<TeamHttpClient>();
try

Просмотреть файл

@ -1,10 +1,9 @@
using System.Collections.Generic;
using Microsoft.VisualStudio.Services.Notifications.WebApi;
using Microsoft.VisualStudio.Services.Notifications.WebApi.Clients;
using Microsoft.VisualStudio.Services.WebApi;
namespace VstsSamples.Client.Notification
namespace Vsts.ClientSamples.Notification
{
/// <summary>
/// Samples for getting details about available notification event types.
@ -12,7 +11,7 @@ namespace VstsSamples.Client.Notification
[ClientSample(NotificationApiConstants.AreaName)]
public class EventTypesSample : ClientSample
{
public EventTypesSample(ClientSampleConfiguration configuration): base(configuration)
public EventTypesSample(ClientSampleContext context): base(context)
{
}
@ -23,7 +22,7 @@ namespace VstsSamples.Client.Notification
[ClientSampleMethod]
public List<NotificationEventType> GetAllEventTypes()
{
VssConnection connection = this.Connection;
VssConnection connection = Context.Connection;
NotificationHttpClient notificationClient = connection.GetClient<NotificationHttpClient>();
List<NotificationEventType> eventTypes = notificationClient.ListEventTypesAsync().Result;
@ -38,7 +37,7 @@ namespace VstsSamples.Client.Notification
[ClientSampleMethod]
public List<NotificationEventType> GetEventTypesAvailableForCustomSubscriptions()
{
VssConnection connection = this.Connection;
VssConnection connection = Context.Connection;
NotificationHttpClient notificationClient = connection.GetClient<NotificationHttpClient>();
List<NotificationEventType> eventTypes = notificationClient.ListEventTypesAsync().Result;

Просмотреть файл

@ -9,7 +9,7 @@ using Microsoft.TeamFoundation.Core.WebApi;
using System;
using System.Linq;
namespace VstsSamples.Client.Notification
namespace Vsts.ClientSamples.Notification
{
/// <summary>
///
@ -23,10 +23,9 @@ namespace VstsSamples.Client.Notification
{
public SubscriptionsSample()
{
}
public SubscriptionsSample(ClientSampleConfiguration configuration): base(configuration)
public SubscriptionsSample(ClientSampleContext context): base(context)
{
}
@ -37,7 +36,7 @@ namespace VstsSamples.Client.Notification
public NotificationSubscription CreateUpdateDeleteSubscription()
{
// Get the client
VssConnection connection = this.Connection;
VssConnection connection = Context.Connection;
NotificationHttpClient notificationClient = connection.GetClient<NotificationHttpClient>();
//
@ -74,10 +73,10 @@ namespace VstsSamples.Client.Notification
};
// Scope to only events from one project
ProjectHttpClient projectClient = this.Connection.GetClient<ProjectHttpClient>();
ProjectHttpClient projectClient = this.Context.Connection.GetClient<ProjectHttpClient>();
Guid projectId;
String projectName = this.Configuration.Get<String>("projectName", null);
String projectName = this.Context.Get<String>("projectName", null);
if (String.IsNullOrEmpty(projectName))
{
@ -95,7 +94,7 @@ namespace VstsSamples.Client.Notification
NotificationSubscription newSubscription = notificationClient.CreateSubscriptionAsync(createParams).Result;
String subscriptionId = newSubscription.Id;
Log("New subscription created! ID: {0}", subscriptionId);
Context.Log("New subscription created! ID: {0}", subscriptionId);
//
// Part 2: disable and delete the subscription
@ -109,7 +108,7 @@ namespace VstsSamples.Client.Notification
newSubscription = notificationClient.UpdateSubscriptionAsync(updateParams, subscriptionId).Result;
Log("Is subscription disabled? {0}", newSubscription.Status < 0);
Context.Log("Is subscription disabled? {0}", newSubscription.Status < 0);
// Delete the subscription
notificationClient.DeleteSubscriptionAsync(subscriptionId).SyncResult();
@ -120,7 +119,7 @@ namespace VstsSamples.Client.Notification
newSubscription = notificationClient.GetSubscriptionAsync(subscriptionId, SubscriptionQueryFlags.IncludeFilterDetails).Result;
} catch (Exception e)
{
Log("Unable to get the deleted subscription:" + e.Message);
Context.Log("Unable to get the deleted subscription:" + e.Message);
}
// Try again (the default query flags says to return deleted subscriptions so this should work)
@ -131,7 +130,7 @@ namespace VstsSamples.Client.Notification
public IEnumerable<IGrouping<string, NotificationSubscription>> GetSubscriptionsGroupedByEventType()
{
VssConnection connection = this.Connection;
VssConnection connection = Context.Connection;
NotificationHttpClient notificationClient = connection.GetClient<NotificationHttpClient>();
// Get existing subscriptions
@ -148,16 +147,16 @@ namespace VstsSamples.Client.Notification
eventType => { return eventType.Id; });
// Show the subscriptions grouped by event type
Log("Custom subscriptions by event type");
Context.Log("Custom subscriptions by event type");
foreach (IGrouping<string, NotificationSubscription> group in groupedSubscriptions)
{
NotificationEventType eventType;
if (eventTypes.TryGetValue(group.Key, out eventType))
{
Log("Event type {0}:", eventType.Name);
Context.Log("Event type {0}:", eventType.Name);
foreach (NotificationSubscription subscription in group)
{
Log(" {0}, last modified: {1} by {2}",
Context.Log(" {0}, last modified: {1} by {2}",
subscription.Description,
subscription.ModifiedDate,
subscription.LastModifiedBy?.DisplayName);
@ -175,13 +174,13 @@ namespace VstsSamples.Client.Notification
[ClientSampleMethod]
public IEnumerable<NotificationSubscription> GetCustomSubscriptions()
{
VssConnection connection = this.Connection;
VssConnection connection = Context.Connection;
NotificationHttpClient notificationClient = connection.GetClient<NotificationHttpClient>();
List<NotificationSubscription> subscriptions = notificationClient.ListSubscriptionsAsync().Result;
Log("Custom subscriptions");
Log("--------------------");
Context.Log("Custom subscriptions");
Context.Log("--------------------");
foreach (var subscription in subscriptions)
{
@ -210,13 +209,13 @@ namespace VstsSamples.Client.Notification
}
};
VssConnection connection = this.Connection;
VssConnection connection = Context.Connection;
NotificationHttpClient notificationClient = connection.GetClient<NotificationHttpClient>();
List<NotificationSubscription> subscriptions = notificationClient.QuerySubscriptionsAsync(query).Result;
Log("Default subscriptions");
Log("---------------------");
Context.Log("Default subscriptions");
Context.Log("---------------------");
foreach (var subscription in subscriptions)
{
@ -237,7 +236,7 @@ namespace VstsSamples.Client.Notification
// Get the event type from the arguments, configuration, or just fallback and use "work item change"
if (String.IsNullOrEmpty(eventType))
{
eventType = this.Configuration.Get<string>("notification.subscriptions.eventType", "ms.vss-work.workitem-changed-event");
eventType = this.Context.Get<string>("notification.subscriptions.eventType", "ms.vss-work.workitem-changed-event");
}
// Setup the query
@ -252,13 +251,13 @@ namespace VstsSamples.Client.Notification
}
};
VssConnection connection = this.Connection;
VssConnection connection = Context.Connection;
NotificationHttpClient notificationClient = connection.GetClient<NotificationHttpClient>();
IEnumerable<NotificationSubscription> subscriptions = notificationClient.QuerySubscriptionsAsync(query).Result;
Log("Custom subscriptions for event type: {0}", eventType);
Log("------------------------------------------------------------");
Context.Log("Custom subscriptions for event type: {0}", eventType);
Context.Log("------------------------------------------------------------");
foreach(NotificationSubscription subscription in subscriptions)
{
@ -275,7 +274,7 @@ namespace VstsSamples.Client.Notification
[ClientSampleMethod]
public NotificationSubscription CreateCustomPersonalSubscription()
{
NotificationHttpClient notificationClient = this.Connection.GetClient<NotificationHttpClient>();
NotificationHttpClient notificationClient = Context.Connection.GetClient<NotificationHttpClient>();
// Query the available event types and find the first that can be used in a custom subscription
List<NotificationEventType> eventTypes = notificationClient.ListEventTypesAsync().Result;
@ -303,7 +302,7 @@ namespace VstsSamples.Client.Notification
[ClientSampleMethod]
public IEnumerable<NotificationSubscription> GetSubscriptionsForTeam(string projectName, string teamName)
{
VssConnection connection = this.Connection;
VssConnection connection = Context.Connection;
TeamHttpClient teamClient = connection.GetClient<TeamHttpClient>();
WebApiTeam team = teamClient.GetTeamAsync(projectName, teamName).Result;
@ -312,8 +311,8 @@ namespace VstsSamples.Client.Notification
IEnumerable<NotificationSubscription> subscriptions = notificationClient.ListSubscriptionsAsync(subscriber: team.Id).Result;
Log("Subscriptions for {0} in {1}", teamName, projectName);
Log("-------------------------------------------------------------------");
Context.Log("Subscriptions for {0} in {1}", teamName, projectName);
Context.Log("-------------------------------------------------------------------");
foreach (var subscription in subscriptions)
{
@ -326,7 +325,7 @@ namespace VstsSamples.Client.Notification
[ClientSampleMethod]
public IEnumerable<NotificationSubscription> GetSubscriptionsForGroup(Guid groupId)
{
VssConnection connection = this.Connection;
VssConnection connection = Context.Connection;
NotificationHttpClient notificationClient = connection.GetClient<NotificationHttpClient>();
// Return all subscriptions, includuing minimal details for subscriptions the caller doesn't have access to
@ -342,7 +341,7 @@ namespace VstsSamples.Client.Notification
public void ShowAllTeamSubscriptions(String projectName = null)
{
// Get clients
VssConnection connection = this.Connection;
VssConnection connection = Context.Connection;
TeamHttpClient teamClient = connection.GetClient<TeamHttpClient>();
NotificationHttpClient notificationClient = connection.GetClient<NotificationHttpClient>();
@ -352,7 +351,7 @@ namespace VstsSamples.Client.Notification
if (String.IsNullOrEmpty(projectName))
{
projectName = this.Configuration.Get<String>("projectName", null);
projectName = this.Context.Get<String>("projectName", null);
}
// Get all teams in the project
@ -386,8 +385,8 @@ namespace VstsSamples.Client.Notification
// Find the corresponding team for this group
WebApiTeam team = teams.First(t => { return t.Id.Equals(group.Key); });
Log("Subscriptions for team {0} (subscriber ID: {1})", team.Name, team.Id);
Log("--------------------------------------------------------------------------------------");
Context.Log("Subscriptions for team {0} (subscriber ID: {1})", team.Name, team.Id);
Context.Log("--------------------------------------------------------------------------------------");
// Show the details for each subscription owned by this team
foreach (NotificationSubscription subscription in group)
@ -406,7 +405,7 @@ namespace VstsSamples.Client.Notification
[ClientSampleMethod]
public NotificationSubscription FollowWorkItem(int workItemId)
{
VssConnection connection = this.Connection;
VssConnection connection = Context.Connection;
WorkItemTrackingHttpClient witClient = connection.GetClient<WorkItemTrackingHttpClient>();
WorkItem workItem = witClient.GetWorkItemAsync(workItemId).Result;
@ -428,7 +427,7 @@ namespace VstsSamples.Client.Notification
protected void LogSubscription(NotificationSubscription subscription)
{
Log(" {0}: {1}, last modified on {2} by {3}",
Context.Log(" {0}: {1}, last modified on {2} by {3}",
subscription.Id,
subscription.Description,
subscription.ModifiedDate,

Просмотреть файл

@ -4,19 +4,19 @@ using Microsoft.TeamFoundation.Work.WebApi;
using System;
using System.Collections.Generic;
namespace VstsSamples.Client.Work
namespace Vsts.ClientSamples.Work
{
public class TeamSettingsSample : ClientSample
{
public TeamSettingsSample(ClientSampleConfiguration configuration) : base(configuration)
public TeamSettingsSample(ClientSampleContext context) : base(context)
{
}
[ClientSampleMethod]
public TeamSetting GetTeamSettings(string project)
{
VssConnection connection = this.Connection;
VssConnection connection = Context.Connection;
WorkHttpClient workClient = connection.GetClient<WorkHttpClient>();
var context = new TeamContext(project);
@ -40,7 +40,7 @@ namespace VstsSamples.Client.Work
BacklogVisibilities = backlogVisibilities
};
VssConnection connection = this.Connection;
VssConnection connection = Context.Connection;
WorkHttpClient workClient = connection.GetClient<WorkHttpClient>();
var context = new TeamContext(project);

Просмотреть файл

@ -5,7 +5,7 @@ using Microsoft.VisualStudio.Services.WebApi;
using System;
using System.IO;
namespace VstsSamples.Client.WorkItemTracking
namespace Vsts.ClientSamples.WorkItemTracking
{
/// <summary>
///
@ -17,15 +17,14 @@ namespace VstsSamples.Client.WorkItemTracking
[ClientSample(WitConstants.WorkItemTrackingWebConstants.RestAreaName, WitConstants.WorkItemTrackingRestResources.Attachments)]
public class AttachmentsSample : ClientSample
{
public AttachmentsSample(ClientSampleConfiguration configuration) : base(configuration)
public AttachmentsSample(ClientSampleContext context) : base(context)
{
}
[ClientSampleMethod]
public void DownloadAttachment(Guid attachmentId, string saveToFile)
{
VssConnection connection = this.Connection;
VssConnection connection = Context.Connection;
WorkItemTrackingHttpClient workItemTrackingClient = connection.GetClient<WorkItemTrackingHttpClient>();
Stream attachmentStream = workItemTrackingClient.GetAttachmentContentAsync(attachmentId).Result;
@ -39,7 +38,7 @@ namespace VstsSamples.Client.WorkItemTracking
[ClientSampleMethod]
public AttachmentReference UploadTextFile(string filePath)
{
VssConnection connection = this.Connection;
VssConnection connection = Context.Connection;
WorkItemTrackingHttpClient workItemTrackingClient = connection.GetClient<WorkItemTrackingHttpClient>();
AttachmentReference attachmentReference = workItemTrackingClient.CreateAttachmentAsync(@filePath).Result;
@ -50,7 +49,7 @@ namespace VstsSamples.Client.WorkItemTracking
[ClientSampleMethod]
public AttachmentReference UploadBinaryFile(string filePath)
{
VssConnection connection = this.Connection;
VssConnection connection = Context.Connection;
WorkItemTrackingHttpClient workItemTrackingClient = connection.GetClient<WorkItemTrackingHttpClient>();
AttachmentReference attachmentReference = workItemTrackingClient.CreateAttachmentAsync(@filePath).Result;

Просмотреть файл

@ -6,14 +6,14 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VstsSamples.Client.WorkItemTracking
namespace Vsts.ClientSamples.WorkItemTracking
{
public class BatchSample : ClientSample
{
public void Run()
{
VssConnection connection = this.Connection;
VssConnection connection = Context.Connection;
WorkItemTrackingHttpClient workItemTrackingClient = connection.GetClient<WorkItemTrackingHttpClient>();

Просмотреть файл

@ -4,7 +4,7 @@ using Microsoft.VisualStudio.Services.WebApi;
using System;
using System.Collections.Generic;
namespace VstsSamples.Client.WorkItemTracking
namespace Vsts.ClientSamples.WorkItemTracking
{
/// <summary>
///
@ -17,14 +17,14 @@ namespace VstsSamples.Client.WorkItemTracking
public class ClassificationNodesSample : ClientSample
{
public ClassificationNodesSample(ClientSampleConfiguration configuration) : base(configuration)
public ClassificationNodesSample(ClientSampleContext context) : base(context)
{
}
[ClientSampleMethod]
public WorkItemClassificationNode GetAreas(string project, int depth)
{
VssConnection connection = this.Connection;
VssConnection connection = Context.Connection;
WorkItemTrackingHttpClient workItemTrackingClient = connection.GetClient<WorkItemTrackingHttpClient>();
WorkItemClassificationNode result = workItemTrackingClient.GetClassificationNodeAsync(project, TreeStructureGroup.Areas, null, depth).Result;
@ -35,7 +35,7 @@ namespace VstsSamples.Client.WorkItemTracking
[ClientSampleMethod]
public WorkItemClassificationNode GetIterations(string project, int depth)
{
VssConnection connection = this.Connection;
VssConnection connection = Context.Connection;
WorkItemTrackingHttpClient workItemTrackingClient = connection.GetClient<WorkItemTrackingHttpClient>();
WorkItemClassificationNode result = workItemTrackingClient.GetClassificationNodeAsync(project, TreeStructureGroup.Iterations, null, depth).Result;
@ -46,7 +46,7 @@ namespace VstsSamples.Client.WorkItemTracking
[ClientSampleMethod]
public WorkItemClassificationNode GetArea(string project, string path)
{
VssConnection connection = this.Connection;
VssConnection connection = Context.Connection;
WorkItemTrackingHttpClient workItemTrackingClient = connection.GetClient<WorkItemTrackingHttpClient>();
WorkItemClassificationNode result = workItemTrackingClient.GetClassificationNodeAsync(project, TreeStructureGroup.Areas, path, 0).Result;
@ -57,7 +57,7 @@ namespace VstsSamples.Client.WorkItemTracking
[ClientSampleMethod]
public WorkItemClassificationNode GetIteration(string project, string path)
{
VssConnection connection = this.Connection;
VssConnection connection = Context.Connection;
WorkItemTrackingHttpClient workItemTrackingClient = connection.GetClient<WorkItemTrackingHttpClient>();
WorkItemClassificationNode result = workItemTrackingClient.GetClassificationNodeAsync(project, TreeStructureGroup.Iterations, path, 0).Result;
@ -74,7 +74,7 @@ namespace VstsSamples.Client.WorkItemTracking
StructureType = TreeNodeStructureType.Area
};
VssConnection connection = this.Connection;
VssConnection connection = Context.Connection;
WorkItemTrackingHttpClient workItemTrackingClient = connection.GetClient<WorkItemTrackingHttpClient>();
WorkItemClassificationNode result = workItemTrackingClient.CreateOrUpdateClassificationNodeAsync(node, project, TreeStructureGroup.Areas, "").Result;
@ -96,7 +96,7 @@ namespace VstsSamples.Client.WorkItemTracking
//Attributes = dict
};
VssConnection connection = this.Connection;
VssConnection connection = Context.Connection;
WorkItemTrackingHttpClient workItemTrackingClient = connection.GetClient<WorkItemTrackingHttpClient>();
WorkItemClassificationNode result = workItemTrackingClient.CreateOrUpdateClassificationNodeAsync(node, project, TreeStructureGroup.Iterations, "").Result;
@ -112,7 +112,7 @@ namespace VstsSamples.Client.WorkItemTracking
StructureType = TreeNodeStructureType.Area
};
VssConnection connection = this.Connection;
VssConnection connection = Context.Connection;
WorkItemTrackingHttpClient workItemTrackingClient = connection.GetClient<WorkItemTrackingHttpClient>();
WorkItemClassificationNode result = workItemTrackingClient.UpdateClassificationNodeAsync(node, project, TreeStructureGroup.Areas, path).Result;
@ -129,7 +129,7 @@ namespace VstsSamples.Client.WorkItemTracking
StructureType = TreeNodeStructureType.Iteration
};
VssConnection connection = this.Connection;
VssConnection connection = Context.Connection;
WorkItemTrackingHttpClient workItemTrackingClient = connection.GetClient<WorkItemTrackingHttpClient>();
WorkItemClassificationNode result = workItemTrackingClient.UpdateClassificationNodeAsync(node, project, TreeStructureGroup.Iterations, path).Result;
@ -150,7 +150,7 @@ namespace VstsSamples.Client.WorkItemTracking
Attributes = dict
};
VssConnection connection = this.Connection;
VssConnection connection = Context.Connection;
WorkItemTrackingHttpClient workItemTrackingClient = connection.GetClient<WorkItemTrackingHttpClient>();
WorkItemClassificationNode result = workItemTrackingClient.UpdateClassificationNodeAsync(node, project, TreeStructureGroup.Iterations, name).Result;
@ -166,7 +166,7 @@ namespace VstsSamples.Client.WorkItemTracking
StructureType = TreeNodeStructureType.Area
};
VssConnection connection = this.Connection;
VssConnection connection = Context.Connection;
WorkItemTrackingHttpClient workItemTrackingClient = connection.GetClient<WorkItemTrackingHttpClient>();
WorkItemClassificationNode result = workItemTrackingClient.UpdateClassificationNodeAsync(node, project, TreeStructureGroup.Areas, targetArea).Result;
@ -182,7 +182,7 @@ namespace VstsSamples.Client.WorkItemTracking
StructureType = TreeNodeStructureType.Iteration
};
VssConnection connection = this.Connection;
VssConnection connection = Context.Connection;
WorkItemTrackingHttpClient workItemTrackingClient = connection.GetClient<WorkItemTrackingHttpClient>();
WorkItemClassificationNode result = workItemTrackingClient.UpdateClassificationNodeAsync(node, project, TreeStructureGroup.Iterations, targetIteration).Result;
@ -193,7 +193,7 @@ namespace VstsSamples.Client.WorkItemTracking
[ClientSampleMethod]
public bool DeleteArea(string project, string areaPath, int reclassifyId)
{
VssConnection connection = this.Connection;
VssConnection connection = Context.Connection;
WorkItemTrackingHttpClient workItemTrackingClient = connection.GetClient<WorkItemTrackingHttpClient>();
try
@ -212,7 +212,7 @@ namespace VstsSamples.Client.WorkItemTracking
[ClientSampleMethod]
public bool DeleteIteration(string project, string iterationPath, int reclassifyId)
{
VssConnection connection = this.Connection;
VssConnection connection = Context.Connection;
WorkItemTrackingHttpClient workItemTrackingClient = connection.GetClient<WorkItemTrackingHttpClient>();
try
@ -230,7 +230,7 @@ namespace VstsSamples.Client.WorkItemTracking
[ClientSampleMethod]
public List<string> GetFullTree(string project, TreeStructureGroup type)
{
VssConnection connection = this.Connection;
VssConnection connection = Context.Connection;
WorkItemTrackingHttpClient workItemTrackingClient = connection.GetClient<WorkItemTrackingHttpClient>();
WorkItemClassificationNode rootNode = workItemTrackingClient.GetClassificationNodeAsync(project, type, null, 1000).Result;

Просмотреть файл

@ -6,7 +6,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
namespace VstsSamples.Client.WorkItemTracking
namespace Vsts.ClientSamples.WorkItemTracking
{
/// <summary>
///
@ -18,14 +18,14 @@ namespace VstsSamples.Client.WorkItemTracking
[ClientSample(WitConstants.WorkItemTrackingWebConstants.RestAreaName, WitConstants.WorkItemTrackingRestResources.Fields)]
public class FieldsSample : ClientSample
{
public FieldsSample(ClientSampleConfiguration configuration) : base(configuration)
public FieldsSample(ClientSampleContext context) : base(context)
{
}
[ClientSampleMethod]
public WorkItemField GetFieldDetails(string fieldName = "System.Title")
{
VssConnection connection = this.Connection;
VssConnection connection = Context.Connection;
WorkItemTrackingHttpClient workItemTrackingClient = connection.GetClient<WorkItemTrackingHttpClient>();
List<WorkItemField> result = workItemTrackingClient.GetFieldsAsync().Result;
@ -38,7 +38,7 @@ namespace VstsSamples.Client.WorkItemTracking
[ClientSampleMethod]
public IEnumerable<WorkItemField> GetReadOnlyWorkItemFields()
{
VssConnection connection = this.Connection;
VssConnection connection = Context.Connection;
WorkItemTrackingHttpClient workItemTrackingClient = connection.GetClient<WorkItemTrackingHttpClient>();
List<WorkItemField> result = workItemTrackingClient.GetFieldsAsync().Result;

Просмотреть файл

@ -5,20 +5,20 @@ using System;
using System.Collections.Generic;
using System.Linq;
namespace VstsSamples.Client.WorkItemTracking
namespace Vsts.ClientSamples.WorkItemTracking
{
[ClientSample(WitConstants.WorkItemTrackingWebConstants.RestAreaName, WitConstants.WorkItemTrackingRestResources.Queries)]
public class QueriesSample : ClientSample
{
public QueriesSample(ClientSampleConfiguration configuration) : base(configuration)
public QueriesSample(ClientSampleContext context) : base(context)
{
}
[ClientSampleMethod]
public QueryHierarchyItem GetQueryByName(string project, string queryName)
{
VssConnection connection = this.Connection;
VssConnection connection = Context.Connection;
WorkItemTrackingHttpClient workItemTrackingClient = connection.GetClient<WorkItemTrackingHttpClient>();
QueryHierarchyItem query = workItemTrackingClient.GetQueryAsync(project, queryName).Result;
@ -36,7 +36,7 @@ namespace VstsSamples.Client.WorkItemTracking
[ClientSampleMethod]
public WorkItemQueryResult ExecuteQuery(Guid queryId)
{
VssConnection connection = this.Connection;
VssConnection connection = Context.Connection;
WorkItemTrackingHttpClient workItemTrackingClient = connection.GetClient<WorkItemTrackingHttpClient>();
WorkItemQueryResult queryResult = workItemTrackingClient.QueryByIdAsync(queryId).Result;
@ -54,7 +54,7 @@ namespace VstsSamples.Client.WorkItemTracking
[ClientSampleMethod]
public WorkItemQueryResult ExecuteByWiql(Wiql wiql, string project)
{
VssConnection connection = this.Connection;
VssConnection connection = Context.Connection;
WorkItemTrackingHttpClient workItemTrackingClient = connection.GetClient<WorkItemTrackingHttpClient>();
WorkItemQueryResult queryResult = workItemTrackingClient.QueryByWiqlAsync(wiql, project).Result;
@ -65,7 +65,7 @@ namespace VstsSamples.Client.WorkItemTracking
[ClientSampleMethod]
public IEnumerable<WorkItem> GetWorkItemsFromQuery(string projectName, string queryName)
{
VssConnection connection = this.Connection;
VssConnection connection = Context.Connection;
WorkItemTrackingHttpClient workItemTrackingClient = connection.GetClient<WorkItemTrackingHttpClient>();
QueryHierarchyItem queryItem;
@ -120,7 +120,7 @@ namespace VstsSamples.Client.WorkItemTracking
"Order By [State] Asc, [Changed Date] Desc" : wiqlString)
};
VssConnection connection = this.Connection;
VssConnection connection = Context.Connection;
WorkItemTrackingHttpClient workItemTrackingClient = connection.GetClient<WorkItemTrackingHttpClient>();
// execute the query

Просмотреть файл

@ -5,20 +5,20 @@ using Microsoft.VisualStudio.Services.WebApi;
using System;
using System.Collections.Generic;
namespace VstsSamples.Client.WorkItemTracking
namespace Vsts.ClientSamples.WorkItemTracking
{
[ClientSample(WitConstants.WorkItemTrackingWebConstants.RestAreaName, WitConstants.WorkItemTrackingRestResources.WorkItems)]
public class RecycleBinSample : ClientSample
{
public RecycleBinSample(ClientSampleConfiguration configuration) : base(configuration)
public RecycleBinSample(ClientSampleContext context) : base(context)
{
}
[ClientSampleMethod]
public List<WorkItemDeleteShallowReference> GetDeletedItems(string project)
{
VssConnection connection = this.Connection;
VssConnection connection = Context.Connection;
WorkItemTrackingHttpClient workItemTrackingClient = connection.GetClient<WorkItemTrackingHttpClient>();
List<WorkItemDeleteShallowReference> results = workItemTrackingClient.GetDeletedWorkItemsAsync(project).Result;
@ -29,7 +29,7 @@ namespace VstsSamples.Client.WorkItemTracking
[ClientSampleMethod]
public WorkItemDelete GetDeletedItem(int workItemId)
{
VssConnection connection = this.Connection;
VssConnection connection = Context.Connection;
WorkItemTrackingHttpClient workItemTrackingClient = connection.GetClient<WorkItemTrackingHttpClient>();
WorkItemDelete result = workItemTrackingClient.GetDeletedWorkItemAsync(workItemId).Result;
@ -40,7 +40,7 @@ namespace VstsSamples.Client.WorkItemTracking
[ClientSampleMethod]
public WorkItemDelete RestoreItem(int workItemId)
{
VssConnection connection = this.Connection;
VssConnection connection = Context.Connection;
WorkItemTrackingHttpClient workItemTrackingClient = connection.GetClient<WorkItemTrackingHttpClient>();
WorkItemDeleteUpdate updateParameters = new WorkItemDeleteUpdate() {
@ -55,7 +55,7 @@ namespace VstsSamples.Client.WorkItemTracking
[ClientSampleMethod]
public void PermenentlyDeleteItem(int workItemId)
{
VssConnection connection = this.Connection;
VssConnection connection = Context.Connection;
WorkItemTrackingHttpClient workItemTrackingClient = connection.GetClient<WorkItemTrackingHttpClient>();
workItemTrackingClient.DestroyWorkItemAsync(workItemId);

Просмотреть файл

@ -1,9 +1,9 @@
namespace VstsSamples.Client.WorkItemTracking
namespace Vsts.ClientSamples.WorkItemTracking
{
[ClientSample]
public class ReportingSample : ClientSample
{
public ReportingSample(ClientSampleConfiguration configuration) : base(configuration)
public ReportingSample(ClientSampleContext context) : base(context)
{
}

Просмотреть файл

@ -5,9 +5,9 @@ using Microsoft.VisualStudio.Services.WebApi.Patch;
using Microsoft.VisualStudio.Services.WebApi.Patch.Json;
using System;
using System.Collections.Generic;
using VstsSamples.Client;
using Vsts.ClientSamples;
namespace VstsSamples.Client.WorkItemTracking
namespace Vsts.ClientSamples.WorkItemTracking
{
[ClientSample(WitConstants.WorkItemTrackingWebConstants.RestAreaName, WitConstants.WorkItemTrackingRestResources.WorkItems)]
public class WorkItemsSample : ClientSample
@ -16,7 +16,7 @@ namespace VstsSamples.Client.WorkItemTracking
[ClientSampleMethod]
public List<WorkItem> GetWorkItemsByIDs(IEnumerable<int> ids)
{
VssConnection connection = this.Connection;
VssConnection connection = Context.Connection;
WorkItemTrackingHttpClient workItemTrackingClient = connection.GetClient<WorkItemTrackingHttpClient>();
List<WorkItem> results = workItemTrackingClient.GetWorkItemsAsync(ids).Result;
@ -34,7 +34,7 @@ namespace VstsSamples.Client.WorkItemTracking
"Microsoft.VSTS.Scheduling.RemainingWork"
};
VssConnection connection = this.Connection;
VssConnection connection = Context.Connection;
WorkItemTrackingHttpClient workItemTrackingClient = connection.GetClient<WorkItemTrackingHttpClient>();
List<WorkItem> results = workItemTrackingClient.GetWorkItemsAsync(ids, fields).Result;
@ -52,7 +52,7 @@ namespace VstsSamples.Client.WorkItemTracking
"Microsoft.VSTS.Scheduling.RemainingWork"
};
VssConnection connection = this.Connection;
VssConnection connection = Context.Connection;
WorkItemTrackingHttpClient workItemTrackingClient = connection.GetClient<WorkItemTrackingHttpClient>();
List<WorkItem> results = workItemTrackingClient.GetWorkItemsAsync(ids, fields, asOfDate).Result;
@ -63,7 +63,7 @@ namespace VstsSamples.Client.WorkItemTracking
[ClientSampleMethod]
public List<WorkItem> GetWorkItemsWithLinksAndAttachments(IEnumerable<int> ids)
{
VssConnection connection = this.Connection;
VssConnection connection = Context.Connection;
WorkItemTrackingHttpClient workItemTrackingClient = connection.GetClient<WorkItemTrackingHttpClient>();
List<WorkItem> results = workItemTrackingClient.GetWorkItemsAsync(ids, null, null, WorkItemExpand.All).Result;
@ -74,7 +74,7 @@ namespace VstsSamples.Client.WorkItemTracking
[ClientSampleMethod]
public WorkItem GetWorkItem(int id)
{
VssConnection connection = this.Connection;
VssConnection connection = Context.Connection;
WorkItemTrackingHttpClient workItemTrackingClient = connection.GetClient<WorkItemTrackingHttpClient>();
WorkItem result = workItemTrackingClient.GetWorkItemAsync(id).Result;
@ -85,7 +85,7 @@ namespace VstsSamples.Client.WorkItemTracking
[ClientSampleMethod]
public WorkItem GetWorkItemWithLinksAndAttachments(int id)
{
VssConnection connection = this.Connection;
VssConnection connection = Context.Connection;
WorkItemTrackingHttpClient workItemTrackingClient = connection.GetClient<WorkItemTrackingHttpClient>();
WorkItem result = workItemTrackingClient.GetWorkItemAsync(id, null, null, WorkItemExpand.Relations).Result;
@ -96,7 +96,7 @@ namespace VstsSamples.Client.WorkItemTracking
[ClientSampleMethod]
public WorkItem GetWorkItemFullyExpanded(int id)
{
VssConnection connection = this.Connection;
VssConnection connection = Context.Connection;
WorkItemTrackingHttpClient workItemTrackingClient = connection.GetClient<WorkItemTrackingHttpClient>();
WorkItem result = workItemTrackingClient.GetWorkItemAsync(id, null, null, WorkItemExpand.All).Result;
@ -118,7 +118,7 @@ namespace VstsSamples.Client.WorkItemTracking
}
);
VssConnection connection = this.Connection;
VssConnection connection = Context.Connection;
WorkItemTrackingHttpClient workItemTrackingClient = connection.GetClient<WorkItemTrackingHttpClient>();
WorkItem result = workItemTrackingClient.CreateWorkItemAsync(patchDocument, projectName, "Task").Result;
@ -184,7 +184,7 @@ namespace VstsSamples.Client.WorkItemTracking
}
);
VssConnection connection = this.Connection;
VssConnection connection = Context.Connection;
WorkItemTrackingHttpClient workItemTrackingClient = connection.GetClient<WorkItemTrackingHttpClient>();
WorkItem result = workItemTrackingClient.CreateWorkItemAsync(patchDocument, projectName, "Task").Result;
@ -224,7 +224,7 @@ namespace VstsSamples.Client.WorkItemTracking
}
);
VssConnection connection = this.Connection;
VssConnection connection = Context.Connection;
WorkItemTrackingHttpClient workItemTrackingClient = connection.GetClient<WorkItemTrackingHttpClient>();
WorkItem result = workItemTrackingClient.CreateWorkItemAsync(patchDocument, projectName, "Task", null, true).Result;
@ -264,7 +264,7 @@ namespace VstsSamples.Client.WorkItemTracking
}
);
VssConnection connection = this.Connection;
VssConnection connection = Context.Connection;
WorkItemTrackingHttpClient workItemTrackingClient = connection.GetClient<WorkItemTrackingHttpClient>();
WorkItem result = workItemTrackingClient.UpdateWorkItemAsync(patchDocument, id).Result;
@ -301,7 +301,7 @@ namespace VstsSamples.Client.WorkItemTracking
}
);
VssConnection connection = this.Connection;
VssConnection connection = Context.Connection;
WorkItemTrackingHttpClient workItemTrackingClient = connection.GetClient<WorkItemTrackingHttpClient>();
WorkItem result = workItemTrackingClient.UpdateWorkItemAsync(patchDocument, id).Result;
@ -330,7 +330,7 @@ namespace VstsSamples.Client.WorkItemTracking
}
);
VssConnection connection = this.Connection;
VssConnection connection = Context.Connection;
WorkItemTrackingHttpClient workItemTrackingClient = connection.GetClient<WorkItemTrackingHttpClient>();
WorkItem result = workItemTrackingClient.UpdateWorkItemAsync(patchDocument, id).Result;
@ -352,7 +352,7 @@ namespace VstsSamples.Client.WorkItemTracking
}
);
VssConnection connection = this.Connection;
VssConnection connection = Context.Connection;
WorkItemTrackingHttpClient workItemTrackingClient = connection.GetClient<WorkItemTrackingHttpClient>();
WorkItem result = workItemTrackingClient.UpdateWorkItemAsync(patchDocument, id).Result;
@ -363,7 +363,7 @@ namespace VstsSamples.Client.WorkItemTracking
[ClientSampleMethod]
public WorkItem AddLinkToOtherWorkItem(int id, int targetId)
{
VssConnection connection = this.Connection;
VssConnection connection = Context.Connection;
WorkItemTrackingHttpClient workItemTrackingClient = connection.GetClient<WorkItemTrackingHttpClient>();
// Get work target work item
@ -411,7 +411,7 @@ namespace VstsSamples.Client.WorkItemTracking
}
);
VssConnection connection = this.Connection;
VssConnection connection = Context.Connection;
WorkItemTrackingHttpClient workItemTrackingClient = connection.GetClient<WorkItemTrackingHttpClient>();
WorkItem result = workItemTrackingClient.UpdateWorkItemAsync(patchDocument, id).Result;
@ -438,7 +438,7 @@ namespace VstsSamples.Client.WorkItemTracking
}
);
VssConnection connection = this.Connection;
VssConnection connection = Context.Connection;
WorkItemTrackingHttpClient workItemTrackingClient = connection.GetClient<WorkItemTrackingHttpClient>();
WorkItem result = workItemTrackingClient.UpdateWorkItemAsync(patchDocument, id).Result;
@ -449,7 +449,7 @@ namespace VstsSamples.Client.WorkItemTracking
[ClientSampleMethod]
public WorkItem AddAttachment(int id, string filePath)
{
VssConnection connection = this.Connection;
VssConnection connection = Context.Connection;
WorkItemTrackingHttpClient workItemTrackingClient = connection.GetClient<WorkItemTrackingHttpClient>();
// upload attachment to store and get a reference to that file
@ -516,7 +516,7 @@ namespace VstsSamples.Client.WorkItemTracking
}
);
VssConnection connection = this.Connection;
VssConnection connection = Context.Connection;
WorkItemTrackingHttpClient workItemTrackingClient = connection.GetClient<WorkItemTrackingHttpClient>();
WorkItem result = workItemTrackingClient.UpdateWorkItemAsync(patchDocument, id).Result;
@ -552,7 +552,7 @@ namespace VstsSamples.Client.WorkItemTracking
}
);
VssConnection connection = this.Connection;
VssConnection connection = Context.Connection;
WorkItemTrackingHttpClient workItemTrackingClient = connection.GetClient<WorkItemTrackingHttpClient>();
WorkItem result = workItemTrackingClient.UpdateWorkItemAsync(patchDocument, id).Result;
@ -588,7 +588,7 @@ namespace VstsSamples.Client.WorkItemTracking
}
);
VssConnection connection = this.Connection;
VssConnection connection = Context.Connection;
WorkItemTrackingHttpClient workItemTrackingClient = connection.GetClient<WorkItemTrackingHttpClient>();
WorkItem result = workItemTrackingClient.UpdateWorkItemAsync(patchDocument, id).Result;
@ -609,7 +609,7 @@ namespace VstsSamples.Client.WorkItemTracking
}
);
VssConnection connection = this.Connection;
VssConnection connection = Context.Connection;
WorkItemTrackingHttpClient workItemTrackingClient = connection.GetClient<WorkItemTrackingHttpClient>();
WorkItem result = workItemTrackingClient.UpdateWorkItemAsync(patchDocument, id, null, true).Result;
@ -620,7 +620,7 @@ namespace VstsSamples.Client.WorkItemTracking
[ClientSampleMethod]
public WorkItemDelete DeleteWorkItem(int id)
{
VssConnection connection = this.Connection;
VssConnection connection = Context.Connection;
WorkItemTrackingHttpClient workItemTrackingClient = connection.GetClient<WorkItemTrackingHttpClient>();
WorkItemDelete results = workItemTrackingClient.DeleteWorkItemAsync(id, false).Result;
@ -663,7 +663,7 @@ namespace VstsSamples.Client.WorkItemTracking
}
);
VssConnection connection = this.Connection;
VssConnection connection = Context.Connection;
WorkItemTrackingHttpClient workItemTrackingClient = connection.GetClient<WorkItemTrackingHttpClient>();
foreach (WorkItemReference workItemReference in workItemQueryResult.WorkItems)