[Solved] Issue with API Deleting for Team Foundation Server TFS


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.VisualStudio.Services.Common;
using Microsoft.VisualStudio.Services.Client;
using Microsoft.TeamFoundation.SourceControl.WebApi;
using Microsoft.VisualStudio.Services.WebApi;

namespace ConsoleAppX
{
    class Program
    {
        static void Main(string[] args)
        {
            VssCredentials creds = new VssClientCredentials();
            creds.Storage = new VssClientCredentialStorage();
            VssConnection connection = new VssConnection(new Uri("https://tfsuri"), creds);
            TfvcHttpClient tfvcClient = connection.GetClient<TfvcHttpClient>();
            TfvcItem ti = tfvcClient.GetItemAsync("ProjectName", "$/FilePath","FileName").Result;
            TfvcChange tchange = new TfvcChange(ti,VersionControlChangeType.Delete);          
            List<TfvcChange> change = new List<TfvcChange> { tchange };
            TfvcChangeset tchangeset = new TfvcChangeset();
            tchangeset.Changes = change;
            tfvcClient.CreateChangesetAsync(tchangeset);
        }
    }
}

2

solved Issue with API Deleting for Team Foundation Server TFS