For native applications the best way to authenticate and access Azure DevOps resources is using the Client Libraries. They are .NET libraries made to simplify integration with Azure DevOps and Team Foundation Server (2015 and later). They allow access to both the Traditional Client Object Model and new REST APIs.
This buildable sample will walk you through the steps to create an application which uses the Client Libraries to open an interactive login prompt and use that authentication state to execute a user pre-defined query written in Work Item Query Language. Query results are output into the console.
From a shell or command line:
git clone https://github.com/Microsoft/vsts-auth-samples.git
- Navigate to the sample in cloned repo
vsts-auth-samples/ClientLibraryConsoleAppSample/
- Use Nuget package restore to ensure you have all dependencies installed
- Open the solution file
ClientLibraryConsoleAppSample.csproj
in Visual Studio 2017 - Open CS file
Program.cs
and there is a section with input values to change at the top of the class:azureDevOpsOrganizationUrl
- Mutable value. This is the url to your Azure DevOps/TFS collection, e.g. http://dev.azure.com/organization for Azure DevOps or http://myserver:8080/tfs/DefaultCollection for TFS.
- Build and run solution. After running you should see a list of the IDs all work items which match your query restrictions.