tfs - Visual Studio Team Services Rest API - How to get 'TeamContext'? -


i'm trying build widget visual studio team services dashboard.

when calling apis visual studio's rest clients, many api requires 'teamcontext' input. example:

ipromise<void> deleteteamiteration(teamcontext, id) 

but how 'teamcontext'? tried:

var teamcontext = vss.getwebcontext().team;  

but turns out there 2 types of teamcontexts (detailed below). vss.getwebcontext.team gives first kind. while apis expect second kind.

how second kind of teamcontext?

first kind of teamcontext:

https://www.visualstudio.com/docs/integrate/extensions/reference/client/api/vss/references/sdk_interfaces/teamcontext

enter image description here

second kind of teamcontext:

https://www.visualstudio.com/en-gb/docs/integrate/extensions/reference/client/api/tfs/core/contracts/teamcontext

enter image description here

edit: work around construct 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 elegant thing, works.

the work around right way it. refer link msdn details: developing widget.

var teamcontext: tfs_core_contracts.teamcontext = { projectid: webcontext.project.id, teamid: webcontext.team.id, project: "", team: "" };