GetItem Method (String, VersionSpec, Int32)
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer

VersionControlServer.GetItem Method (String, VersionSpec, Int32)

This function is passed a string that represents a file or folder in Team Foundation Server, and returns an Item object that represents 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,
	int deletionId
)

Parameters

path
Type: System.String

The file or folder that you want to get. This may be a Team Foundation Server path ($/CmdLine/parse.cs) or a local path (C:\Code\CmdLine\parse.cs), in the latter case, the local path is mapped to a server path via a workspace. Wildcards should not be passed here, they will cause an exception to occur.

version
Type: Microsoft.TeamFoundation.VersionControl.Client.VersionSpec

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

deletionId
Type: System.Int32

Assigned deletion ID for the item. To get a non-deleted item, pass 0. Every deleted item has a non-zero deletion ID that is required to identify that item (since one folder may contain multiple deleted items with the same name).

Return Value

Type: Microsoft.TeamFoundation.VersionControl.Client.Item
Returns the requested Item. If the Item is not found, an exception occurs.

ExceptionCondition
[ArgumentException]

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

[VersionControlException]

An exception is thrown if the item was not found.

Show:
© 2016 Microsoft