Get-TFSProject.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# Author: Miodrag Milic <miodrag.milic@gmail.com>
# Last Change: 26-Apr-2016.

<#
.SYNOPSIS
    Get the TFS project details
.EXAMPLE
    Get-TFSProject ProjectXYZ
 
    Get the project 'ProjectXYZ' by its name
.EXAMPLE
    Get-TFSProject 1
 
    Get the project by its TFS numeric id
#>

function Get-TFSProject {
    [CmdletBinding()]
    param(
        #Id or name of the project
        [ValidateNotNullOrEmpty()]
        [string]$Id
    )
    check_credential

    $uri = "$collection_uri/_apis/projects/$($Id)?includeCapabilities=true&api-version=" + $global:tfs.api_version
    Write-Verbose "URI: $uri"

    $params = @{ Uri = $uri; Method = 'Get'}
    invoke_rest $params
}