Giter Site home page Giter Site logo

devopsreplicator's Introduction

copydevops

A tool to copy workitems from a devops project

Usage example:

using copydevops.client; 
using copydevops.repository;
using copydevops.storage;

namespace copydevops
{
    class Program
    {
        static void Main(string[] args)
        {
            Client client = new Client(); 
            client.SetPersonalAccessToken("your devops access token");
            client.Connect();
            
            Repository<LocalStorageDriver> localrepo = new Repository<LocalStorageDriver>();

            // Example 1: Get workitem ID 2
            QueryBuilder q = new QueryBuilder();
            q.SetQueryParams(QueryParams.organization, "your organization");
            q.SetQueryParams(QueryParams.project, "your project");
            q.SetQueryParams(QueryParams.area, "wit/workitems");
            q.SetQueryParams(QueryParams.resource, "workitem id");
            q.SetQueryParams(QueryParams.apiversion, "api-version=6.1-preview.3");

            string uri = q.getQueryAsURI();
            string result = client.GetResponseFromUri(uri).Result;

            File f = new File();
            f.SetFileName("2.txt");
            f.SetFileContent(result);

            localrepo.CreateFile(@"C:\Tmp\", f); // this will save a file name 2.txt en C:\Tmp folder with the content of the workitem. 
        
            // Example 2: Create a new query and retrieve all workitems
            QueryRequestBody body;
            body.name = "All workitems";
            body.wiql = "Select [System.Id], [System.Title], [System.State] From WorkItems";


            q.SetQueryParams(QueryParams.area, "wit/queries");
            q.SetQueryParams(QueryParams.resource, "Shared Queries");
            q.SetQueryParams(QueryParams.apiversion, "api-version=6.0");
            q.SetQueryParams(QueryParams.requestbody, body);

            uri = q.getQueryAsURI();
            result = client.GetResponseFromQuery(q).Result;

            f = new File();
            f.SetFileName("3.txt");
            f.SetFileContent(result);
            localrepo.CreateFile(@"C:\Tmp\", f);
        }
    }
}

run using dotnet run

devopsreplicator's People

Contributors

ccampora avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.