Get Latest Version of Folder from TFS, using Powershell

前端 未结 3 1154
旧时难觅i
旧时难觅i 2020-12-18 03:29

I am trying to \"Get Latest Version\" of a particular folder from TFS, using Powershell.

I have installed the TFS Snappin, and have been using TFS P

3条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-18 03:55

    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("", $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.

提交回复
热议问题