src/LanguagePack/Remove-XrmLanguagePack.ps1
|
<# .SYNOPSIS Desactivate given language .DESCRIPTION Deprovision a language from the target instance. DeprovisionLanguage is synchronous (the platform has no asynchronous message): the request waits up to TimeoutInMinutes for its response. The language is disabled: it leaves Get-XrmProvisionedLanguages and the platform keeps it in its list of deprovisioned languages (RetrieveDeprovisionedLanguages). .PARAMETER XrmClient Xrm connector initialized to target instance. Use latest one by default. (Dataverse ServiceClient) .PARAMETER Language Language name LCID (English = 1033, French = 1036, ...) .PARAMETER TimeoutInMinutes Maximum wait for the response. (Default: 30) .OUTPUTS Microsoft.Xrm.Sdk.OrganizationResponse. Response of DeprovisionLanguage. .EXAMPLE Remove-XrmLanguagePack -XrmClient $xrmClient -Language 1036; .LINK https://github.com/AymericM78/PowerDataOps/blob/main/documentation/commands/Remove-XrmLanguagePack.md #> function Remove-XrmLanguagePack { [CmdletBinding(SupportsShouldProcess)] [OutputType([Microsoft.Xrm.Sdk.OrganizationResponse])] param ( [Parameter(Mandatory = $false, ValueFromPipeline)] [Microsoft.PowerPlatform.Dataverse.Client.ServiceClient] $XrmClient = $Global:XrmClient, [Parameter(Mandatory = $true)] [int] $Language, [Parameter(Mandatory = $false)] [ValidateRange(1, 1440)] [int] $TimeoutInMinutes = 30 ) begin { $StopWatch = [System.Diagnostics.Stopwatch]::StartNew(); Trace-XrmFunction -Name $MyInvocation.MyCommand.Name -Stage Start -Parameters ($MyInvocation.MyCommand.Parameters); } process { $deprovisionLanguageRequest = New-XrmRequest -Name "DeprovisionLanguage"; $deprovisionLanguageRequest | Add-XrmRequestParameter -Name "Language" -Value $Language | Out-Null; $XrmClient | Invoke-XrmRequest -Request $deprovisionLanguageRequest -TimeoutInMinutes $TimeoutInMinutes; } end { $StopWatch.Stop(); Trace-XrmFunction -Name $MyInvocation.MyCommand.Name -Stage Stop -StopWatch $StopWatch; } } Export-ModuleMember -Function Remove-XrmLanguagePack -Alias *; |