Search code examples
javascript.netpluginstfstfs-2015

How do I get all the teams that the user member is (TFS 2015 extension) using js?


I'm trying to write a plugin for TFS 2015 (its important). I read a couple of manuals. the examples all turns out simply, but it is more difficult with a real plugin. my problem: -How do I get all the teams that the user member is

i can get current team from web context:

var context = VSS.getWebContext();
var currTeam = context.team;

but how can i get all avaible teams and groups for current user(or by id)?


Solution

    • To get teams for current user

    You could get the teams through this method getTeams() directly

     IPromise<Contracts.WebApiTeam[]> getTeams(projectId, top, skip)
    
    • To get groups for current user

    It's not able to do this through js or rest api for now. You could either use tfs command to list the info or use TFS API to achieve what you want. Related method in API: List application groups(), readidentities()

    Detail code please refer this question: How to get TFS user groups and users in particular group using TFS API?

    Another script solution you could also take a look, just in case you are interested: Using PowerShell and TFS API to list users