I'm trying to build a widget for Visual studio team services dashboard.
When calling APIs from Visual Studio's rest clients, many API requires an 'TeamContext' as input. For example:
IPromise<void> deleteTeamIteration(teamContext, id)
But how do I get 'TeamContext'? I tried:
var teamContext = VSS.getWebContext().team;
but it turns out there are two types of TeamContexts (detailed below). VSS.getWebContext.team
gives the first kind. While the APIs expect the second kind.
How do I get the second kind of teamContext?
First Kind of TeamContext:
Second Kind of TeamContext:
EDIT: A work around is to construct the second type of TeamContext myself.
var teamContext2 = {
project : VSS.getWebContext().project.name,
projectId : VSS.getWebContext().project.id,
team : VSS.getWebContext().team.name,
teamId : VSS.getWebContext().team.id
};
It's not the most elegant thing, but it works.
The work around is the right way to get it. Refer to this link from MSDN for details: Developing the widget.
var teamContext: TFS_Core_Contracts.TeamContext = { projectId: webContext.project.id, teamId: webContext.team.id, project: "", team: "" };
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments