Dismiss Notice

Register now to be one of the first members of this SharePoint Community! Click here it just takes seconds!

Dismiss Notice
Welcome Guest from Country Flag

Using ReleaseHttpClient for interacting with ReleaseManagement service

Discussion in 'Official Microsoft News' started by Chandan Anjani, May 2, 2016.

Thread Status:
Not open for further replies.
  1. Chandan Anjani

    Chandan Anjani Guest

    Blog Posts:
    0
    ReleaseHttpClient is public as nuget package : https://www.nuget.org/packages/Microsoft.VisualStudio.Services.Release.Client

    Step1: Create one 'Windows Console Application' using Visual studio 2015

    Step2: Goto Tools -->NuGet Package Manager --> Manage NuGet Packages for Solutions --> Browse (make sure Package source: nuget.org)

    Step3: Search and Install following package to your solution

    • Microsoft.VisualStudio.Services.Release.Client
    • Microsoft.VisualStudio.Services.InteractiveClient

    Step4: Add following code to fetch all release definitions for a given project. Please update your tenant and project name in below sample.


    using System;
    using Microsoft.VisualStudio.Services.Client;
    using Microsoft.VisualStudio.Services.Common;
    using Microsoft.VisualStudio.Services.ReleaseManagement.WebApi.Clients;

    namespace ReleaseHttpClientSample
    {
    class Program
    {
    static void Main(string[] args)
    {
    Uri serverUrl = new Uri("https://{your tenant name}.vsrm.visualstudio.com/DefaultCollection");
    VssCredentials credentials = new VssClientCredentials();
    credentials.Storage = new VssClientCredentialStorage();

    VssConnection connection = new VssConnection(serverUrl, credentials);

    ReleaseHttpClient rmClient = connection.GetClient<ReleaseHttpClient>();

    var releaseDefinitions = rmClient.GetReleaseDefinitionsAsync("{your project name}").Result;

    Console.Out.WriteLine("Release definitions " + releaseDefinitions.Count);
    }
    }
    }

    Step5: Done



    [​IMG]

    Continue reading...
     
Thread Status:
Not open for further replies.

Share This Page

LiveZilla Live Chat Software