2017-01-10 3 views
0

私は私の会社のVSTSアカウントの管理者です。時には、ユーザーとプロジェクトをマッピングする必要があります。つまり、特定のユーザーが属するプロジェクトを一覧表示する必要があります。無駄に、私は多くのVSTSの隅々を見て、オンラインの資料を探しました。私はどんな提案にも感謝しています。VSTSはプロジェクトへのユーザーの参加をリストします

+0

は? –

答えて

0

他の方法は、クライアントSDKを通じてそれを達成できるということです。

あなたはを参照することができ、特定のユーザーのためのチームを取得するために簡単なサンプルがあります:あなたは私たちのソリューションで問題を解決してください

TfsTeamProjectCollection collection = new TfsTeamProjectCollection(new Uri("[collection url]")); 

      collection.EnsureAuthenticated(); 

      var structureService= collection.GetService<ICommonStructureService>(); 
      var teamprojects = structureService.ListAllProjects(); 
      TfsTeamService teamService = collection.GetService<TfsTeamService>(); 
      UserInfo user = new UserInfo(); 
      foreach (var tp in teamprojects) 
      { 

       var teamList = teamService.QueryTeams(tp.Uri); 
       foreach(var t in teamList) 
       { 
        var userIdentity = t.GetMembers(collection, MembershipQuery.Expanded).Where(ti=>ti.UniqueName.Equals("[user accunt, e.g. domain\\test]",StringComparison.OrdinalIgnoreCase)).FirstOrDefault(); 
        if(userIdentity!=null) 
        { 
         user.Teams.Add(t.Name); 
         user.Alias = userIdentity.UniqueName; 
         user.DisplayName = userIdentity.DisplayName; 
        } 
       } 
      } 
      Console.WriteLine(user); 
      Console.Read(); 
関連する問題