Public/Get-MITFolderAcl.ps1
function Get-MITFolderAcl { <# .SYNOPSIS Get MOVEit Transfer Folder ACL .LINK Lists the Access Controls for a given folder https://docs.ipswitch.com/MOVEit/Transfer2021/Api/Rest/#operation/GETapi/v1/folders/{Id}/acls?Page={Page}&PerPage={PerPage}&SortField={SortField}&SortDirection={SortDirection}-1.0 #> [CmdletBinding(DefaultParameterSetName='Content')] param ( [Parameter(Mandatory, Position=0, ValueFromPipelineByPropertyName=$true)] [Alias('Id')] [string]$FolderId, [Parameter(Mandatory=$false)] [int32]$Page, [Parameter(Mandatory=$false)] [int32]$PerPage, [Parameter(Mandatory=$false)] [string]$SortField, [Parameter(Mandatory=$false)] [ValidateSet('ascending', 'descending')] [string]$SortDirection, [Parameter(Mandatory=$false)] [switch]$IncludePaging ) try{ # Confirm the token, refreshing if necessary Confirm-MITToken # Set the Uri for this request $uri = "$script:BaseUri/folders/$FolderId/acls" # Set the request headers $headers = @{ Accept = "application/json" Authorization = "Bearer $($script:Token.AccessToken)" } # Build the query parameters. $query = @{} switch ($PSBoundParameters.Keys) { Page { $query['page'] = $Page } PerPage { $query['perPage'] = $PerPage } SortField { $query['sortField'] = $SortField } SortDirection { $query['sortDirection'] = $SortDirection } } $response = Invoke-RestMethod -Uri "$uri" -Headers $headers -Body $query $response | Write-MITResponse -Typename 'MITFolderAcl' -IncludePaging:$IncludePaging } catch { $PSCmdlet.ThrowTerminatingError($PSItem) } } |