-1

I need to create Team Foundation Server projects, but the only way I can find to do it is manually through the website.

Is it possible to do programmatically via a CLI, programming language, or RESTful API?

Thanks in advance.

Michael
  • 2,825
  • 3
  • 24
  • 30
  • What **version** of TFS? Did you Google this first or otherwise do any independent research? This is very well-documented. – Daniel Mann Jan 30 '20 at 00:12

1 Answers1

0

Is it possible to do programmatically via a CLI, programming language, or RESTful API?

It's possible, you can do that using Rest API. Azure Devops Server 2019 and TFS 2018U2 both support creating project using Rest API. TFS2018U2, Azure Devops Server.

More details please refer to this document.

Test with TFS2018U2 in PostMan:

Request URL: https://ServerName:8080/tfs/CollectionName/_apis/projects?api-version=4.1

Request Body:

{
  "name": "CreateProjectTest",
  "description": "Just for Test",
  "capabilities": {
    "versioncontrol": {
      "sourceControlType": "Git"
    },
    "processTemplate": {
      "templateTypeId": "6b724908-ef14-45cf-84f8-768b5384da45"
    }
  }
}

If you get status 202 accepted, then you can see the newly created project in website after some time (For me,10~25 seconds).

Note: The document states the format is https://{instance}/{collection}/_apis/projects?api-version=xxx, but you need to use http instead of https when you Public URL starts with http:

enter image description here

In addition: Here's one similar issue to achieve what you want using CLI. And here's another one that may give you some hint if you want to do that using C# code.

Hope all above helps :)

LoLance
  • 25,666
  • 1
  • 39
  • 73