Get Latest Version of Folder from TFS, using Powershell

痞子三分冷 提交于 2019-11-29 07:02:47

To get latest (tf get) use Update-TfsWorkspace.

Get-TfsChangeset is the equivalent of tf changeset.

Gotcha! with Update-TFSWorskpace. Has some helpful parameters as well. -Items is used to specify the exact items you want to update.

PS D:\Tfs\APD-RepairSolutions\Main>Update-TFSWorkspace -All -Overwrite -Force -Recurse -Items .\Database

The Workspace is replaced with updated versions of items. Thanks @Kmoraz!

If you would like to use the TFS API instead, you can use the Workspace.Get Method:

# Load the TFS assemblies
[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.TeamFoundation.Client")
$ws = $vcServer.QueryWorkspaces("<WORKSPACENAME>", $null, $null);

# Specify properties of intended workspace get
$recursionType = [Microsoft.TeamFoundation.VersionControl.Client.RecursionType]::Full
$latestVersion = [Microsoft.TeamFoundation.VersionControl.Client.VersionSpec]::Latest
$getOptions = [Microsoft.TeamFoundation.VersionControl.Client.GetOptions]::GetAll

# Get what I want!
$ws.Get("$/Remote/Folder", $latestVersion, $recursionType, $getOptions)

Would be a good idea to replace the nulls with your domain login and computer name when Querying Workspaces.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!