functions/Get-ProjectID.ps1

<#
.SYNOPSIS
  
Returns Project ID for given Project Name.
  
.DESCRIPTION
Returns Project ID for given Project Name.
  
.EXAMPLE
Get-ProjectID "project1"
 
Output
1
#>


Function Get-ProjectID
{
    [cmdletbinding()]
    param(
        [Parameter(Mandatory=$true)]
        [string]$ProjectName
    )
    
    Write-Verbose("Checking for project: $($ProjectName)")

    $projectList = Get-AllProjects
    $projectList.projects | ForEach-Object {
        If($_.name -eq $ProjectName) {
            Return $_.id
            Exit
        }
    }
}