Public/DirectoryBrowser/Move-R1DirectoryEntry.ps1

# .ExternalHelp psRadiantOne-help.xml
function Move-R1DirectoryEntry {
    [CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'Medium')]
    [OutputType([void])]
    param(
        [parameter(
            Mandatory = $true,
            ValueFromPipelineByPropertyName = $true
        )]
        [ValidateNotNullOrEmpty()]
        [string]$dn,

        [parameter(
            Mandatory = $true,
            ValueFromPipelineByPropertyName = $true
        )]
        [ValidateNotNullOrEmpty()]
        [string]$newParentDn
    )

    Begin {

        Assert-R1Session -RequireToken

    }#begin

    Process {

        $URI = Resolve-R1ServiceUrl -Service Browser -Path "directory_browser/$($dn | Get-EscapedString)/move_entry"

        $Body = @{ newParentDn = $newParentDn } | ConvertTo-R1JsonBody

        if ($PSCmdlet.ShouldProcess($dn, "Move to $newParentDn")) {

            $null = Invoke-R1RestMethod -Uri $URI -Method POST -Body $Body

        }

    }#process

    End { }#end

}