Export (0) Print
Expand All
Expand Minimize

VersionControlServer.UnlabelItem Method

This method removes a label from one or more items. For instance, you might use this to remove the file parser.cs version 12 from the label Beta 1 and then add the file parser.cs version 15 to that same label. If you remove all the items from a label, the label itself is deleted.

Namespace:  Microsoft.TeamFoundation.VersionControl.Client
Assembly:  Microsoft.TeamFoundation.VersionControl.Client (in Microsoft.TeamFoundation.VersionControl.Client.dll)

public LabelResult[] UnlabelItem(
	string labelName,
	string labelScope,
	ItemSpec[] itemSpecs,
	VersionSpec version


Type: System.String

The name of the label that you want to remove.

Type: System.String

The database path that indicates the scope at which the label is defined.

Type: Microsoft.TeamFoundation.VersionControl.Client.ItemSpec[]
Type: Microsoft.TeamFoundation.VersionControl.Client.VersionSpec

The version of the specified items that you want to remove from the label.

The easiest way to specify this version is by the label itself: new LabelVersionSpec(labelName,labelScope)

Return Value

Type: Microsoft.TeamFoundation.VersionControl.Client.LabelResult[]
Each returned LabelResult object gives a label name (a string), a scope, and a status which is set to LabelResultStatus.Updated for a successful deletion. (Note that even if the label itself is deleted, you will not see LabelResultStatus.Deleted from this function) Any failures are reported out as NonFatalError events.


An exception is thrown if version is null.


An exception is thrown if labelName or itemSpecs are empty or null.

Community Additions

© 2014 Microsoft