public/New-VSADocumentFolder.ps1
|
function New-VSADocumentFolder { <# .Synopsis Adds documents folder on the Audit > Documents page. .DESCRIPTION Adds documents folder on the Audit > Documents page. Takes either persistent or non-persistent connection information. .PARAMETER VSAConnection Specifies existing non-persistent VSAConnection. .PARAMETER URISuffix Specifies URI suffix if it differs from the default. .PARAMETER Folder Specifies new folder relative path. .PARAMETER AgentId Specifies the agent on which the Document folder is created. .EXAMPLE New-VSADocumentFolder -AgentId 10001 -Folder 'NewFolder' .EXAMPLE New-VSADocumentFolder -AgentId 10001 -Folder 'NewFolder' -VSAConnection $connection .INPUTS Accepts piped non-persistent VSAConnection .OUTPUTS True if successful. #> [CmdletBinding(SupportsShouldProcess)] [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSShouldProcess', '', Justification = 'ShouldProcess is invoked centrally by Invoke-VSAWriteRequest, which receives this cmdlet''s $PSCmdlet via -Caller (module-wide pattern).')] param ( [parameter(Mandatory = $false, ValueFromPipelineByPropertyName = $true)] [ValidateNotNull()] [VSAConnection] $VSAConnection, [parameter(DontShow, Mandatory=$false)] [ValidateNotNullOrEmpty()] [string] $URISuffix = 'api/v1.0/assetmgmt/documents/{0}/folder/{1}', [Parameter(Mandatory = $true)] [ValidateScript({ if( $_ -notmatch "^\d+$" ) { throw "Non-numeric Id" } return $true })] [string] $AgentId, [Parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] [string] $Folder ) process { $Folder = $Folder -replace '\\', '/' $URISuffix = $URISuffix -f $AgentId, $Folder return Invoke-VSAWriteRequest -Method 'PUT' -URISuffix ($URISuffix) -VSAConnection $VSAConnection -Caller $PSCmdlet } } New-Alias -Name Add-VSADocumentFolder -Value New-VSADocumentFolder Export-ModuleMember -Function New-VSADocumentFolder -Alias Add-VSADocumentFolder |