Remove-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
# Author: Miodrag Milic <miodrag.milic@gmail.com>
# Last Change: 25-Apr-2016.

<#
.SYNOPSIS
    Get the TFS project
#>

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

    if ($Id.Length -ne 36) { $Id = Get-TFSProject $Id | % id }
    if ($Id -eq $null) { throw "Can't find project with that name or id: '$Id'" }
    Write-Verbose "Project id: $Id"

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

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