2016-08-02 1 views
0

Team Foundationリポジトリのコレクションの各モジュール内にいくつのラベルがあるか調べる必要があります。 私はTFS 2013を使用しています。 Visual Studioから入手できます。しかし、出力としてラベルの数を取得するスクリプトが必要です。 誰かが同じものを得るためにC#やPowershellコードを手に入れてもらえますか?TFSリポジトリのモジュール内のラベルの総数

TIA

+0

あなたがこれまでに試してみました何を?これを読んでください:http://stackoverflow.com/help/how-to-ask –

答えて

1

あなたはこの取得するには、.NETクライアントライブラリを使用することができます。.NET client libraries for Visual Studio Team Services (and TFS)

コードサンプル:

using System; 
using Microsoft.TeamFoundation.Client; 
using Microsoft.TeamFoundation.VersionControl.Client; 

namespace GetLabels 
{ 
    class Program 
    { 
     static void Main(string[] args) 
     { 
      string tfscollection = "http://xxx:8080/tfs/defaultcollection"; 
      TfsTeamProjectCollection ttpc = new TfsTeamProjectCollection(new Uri(tfscollection)); 
      VersionControlServer vcs = ttpc.GetService<VersionControlServer>(); 
      string labelname = null; 
      string labelscope = "$/"; 
      string owner = null; 
      bool includeitem = false; 
      int labelnumber; 
      VersionControlLabel[] labels = vcs.QueryLabels(labelname,labelscope,owner,includeitem); 
      labelnumber = labels.Length; 
      Console.WriteLine(labelnumber); 
      Console.ReadLine(); 
     } 
    } 
} 
+0

同様に、コレクション内の各モジュールの現在のサイズを取得するコードはありますか? –

関連する問題