This repository contains C# samples that show how to integrate with Team Services and Team Foundation Server using our public client libraries.
Samples are organized by "area" (service) and "resource" within the Microsoft.TeamServices.Samples.Client
project. Each sample class shows various ways for interacting with Team Services and Team Foundation Server.
-
Clone this repository and open in Visual Studio (2015 or later)
-
Build the solution (you may need to restore the required NuGet packages first)
-
Run the
Microsoft.TeamServices.Samples.Client.Runner
project with the required arguments:/url:{value}
: URL of the account/collection to run the samples against./area:{value}
: API area (work, wit, notification, git, core, build) to run the client samples for. Use * to include all areas./resource:{value}
: API resource to run the client samples for. Use * to include all resources.
IMPORTANT: some samples are destructive. It is recommended that you first run the samples against a test account.
Microsoft.TeamServices.Samples.Client.Runner.exe
/url:https://fabrikam.visualstudio.com /area:* /resource:*
Microsoft.TeamServices.Samples.Client.Runner.exe
/url:https://fabrikam.visualstudio.com /area:wit /resource:*
Microsoft.TeamServices.Samples.Client.Runner.exe
/url:https://fabrikam.vssps.visualstudio.com /area:graph /resource:*
Microsoft.TeamServices.Samples.Client.Runner.exe
/url:https://fabrikam.visualstudio.com /area:git /resource:pullrequests
Microsoft.TeamServices.Samples.Client.Runner.exe
/url:https://mytfs:8080/tfs/testcollection /area:git /resource:*
To persist the HTTP request/response as JSON for each client sample method that is run, set the /outputPath:{value}
argument. For example:
Microsoft.TeamServices.Samples.Client.Runner.exe
/url:https://fabrikam.visualstudio.com /area:* /resource:* /outputPath:c:\temp\http-output
This creates a folder for each area, a folder for each resource under the area folder, and a file for each client sample method that was run. The name of the JSON file is determined by the name of the client sample method. For example:
|-- temp
|-- http-output
|-- Notification
|-- EventTypes
|-- ...
|-- Subscriptions
|-- CreateSubscriptionForUser.json
|-- QuerySubscriptionsByEventType.json
|-- ...
Note: certain HTTP headers like Authorization
are removed for security/privacy purposes.
For .NET developers building Windows apps and services that integrate with Visual Studio Team Services, client libraries are available for integrating with work item tracking, version control, build, and other services are now available. These packages replace the traditional TFS Client OM installer and make it easy to acquire and redistribute the libraries needed by your app or service.
See .NET client libraries for Team Services documentation for more getting started details.
For developers that want to contribute, learn how to contribute a sample.