How to create a label in TFS/TFVC using the REST API?

965 Views Asked by At

I know how to create a label in TFVC from within Visual Studio. I know the REST API can query for labels. But how do I create a label using the REST API?

Microsoft documentation does not cover it: https://www.visualstudio.com/en-us/docs/integrate/api/tfvc/labels

Thanks!

1

There are 1 best solutions below

2
On

Currently we cannot create a label using the REST API, just as you mentioned, according to the official documents this feature is not supported.

However you can create a label using TFS API with VersionControlServer.CreateLabel Method, See below sample for your reference:

Besides, you can also create a label with the Label Command

eg:

The following example uses the scope option to apply a label to 314.cs.

c:\projects>tf label goodbuild@$/TeamProject1 314.cs