如何在 TFS 2015 中使用 Rest API 在团队项目中创建新团队
How to create a new Team inside team project using Rest API in TFS 2015
我正在使用带有更新 2 的 TFS 2015。我正在尝试使用 TFS rest APIs 在 TFS 中创建、更新和删除内容,而不是使用 Web 界面。
我们已经从 TFS 开箱即用 API 来创建团队项目。但是 TFS Official 中没有列出 API 以在团队项目中创建新团队。
我试过 Powertools exe。它也没有创建新团队的方法。
有人可以帮助我了解如何使用 Rest 在团队项目中创建新团队 API。
其余API暂时只能获取Team Project中的团队,不支持创建团队。详情参考这个link:Teams. You can submit a feature request on VSTS User Voice.
另一种方法是使用 .NET client libraries for Visual Studio Team Services (and TFS),下面是代码示例:
using System;
using System.Collections.Generic;
using Microsoft.TeamFoundation.Client;
namespace ConsoleApplica
{
class Program
{
static void Main(string[] args)
{
string URL = "https://xxxxxx.visualstudio.com/";
TfsTeamProjectCollection ttpc = new TfsTeamProjectCollection(new Uri(URL));
TfsTeamService tts = ttpc.GetService<TfsTeamService>();
string teamprojecturi = "teamprojecturi";
string newteamname = "newteam";
string teamdescription = "newteamdescription";
IDictionary<string, object> prop = null;//properties, can be null or empty
tts.CreateTeam(teamprojecturi, newteamname,teamdescription,prop);
}
}
}
我正在使用带有更新 2 的 TFS 2015。我正在尝试使用 TFS rest APIs 在 TFS 中创建、更新和删除内容,而不是使用 Web 界面。 我们已经从 TFS 开箱即用 API 来创建团队项目。但是 TFS Official 中没有列出 API 以在团队项目中创建新团队。
我试过 Powertools exe。它也没有创建新团队的方法。
有人可以帮助我了解如何使用 Rest 在团队项目中创建新团队 API。
其余API暂时只能获取Team Project中的团队,不支持创建团队。详情参考这个link:Teams. You can submit a feature request on VSTS User Voice.
另一种方法是使用 .NET client libraries for Visual Studio Team Services (and TFS),下面是代码示例:
using System;
using System.Collections.Generic;
using Microsoft.TeamFoundation.Client;
namespace ConsoleApplica
{
class Program
{
static void Main(string[] args)
{
string URL = "https://xxxxxx.visualstudio.com/";
TfsTeamProjectCollection ttpc = new TfsTeamProjectCollection(new Uri(URL));
TfsTeamService tts = ttpc.GetService<TfsTeamService>();
string teamprojecturi = "teamprojecturi";
string newteamname = "newteam";
string teamdescription = "newteamdescription";
IDictionary<string, object> prop = null;//properties, can be null or empty
tts.CreateTeam(teamprojecturi, newteamname,teamdescription,prop);
}
}
}