This documentation is archived and is not being maintained.

VersionControlServer.GetItem Method (String, VersionSpec)

This function is passed a string that represents a file or folder in Team Foundation Server, and returns an Item object that represents a non-deleted version of that item, but download information is not included. Without download information the function call is faster, but if you want to download files, you should use one of the overload methods that will allow you to get download information with the returned items.

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

public Item GetItem(
	string path,
	VersionSpec version


Type: System.String
Type: Microsoft.TeamFoundation.VersionControl.Client.VersionSpec

The version that you want to get. You must use Use VersionSpec.Latest to get the current version.

Return Value

Type: Microsoft.TeamFoundation.VersionControl.Client.Item
Returns an Item object for the specified item. If the item is not found, an exception occurs You can avoid an exception by first calling ServerItemExists.


An exception is thrown if there is a wildcard character in path.


An exception is thrown if the item was not found.