File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed
Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Standards Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change 11using namespace System.Net
22
3- Function Invoke-RemoveStandardTemplate {
3+ function Invoke-RemoveStandardTemplate {
44 <#
55 . FUNCTIONALITY
66 Entrypoint,AnyTenant
@@ -19,9 +19,20 @@ Function Invoke-RemoveStandardTemplate {
1919 try {
2020 $Table = Get-CippTable - tablename ' templates'
2121 $Filter = " PartitionKey eq 'StandardsTemplateV2' and RowKey eq '$id '"
22- $ClearRow = Get-CIPPAzDataTableEntity @Table - Filter $Filter - Property PartitionKey, RowKey
22+ $ClearRow = Get-CIPPAzDataTableEntity @Table - Filter $Filter - Property PartitionKey, RowKey, JSON
23+ if (! $ClearRow ) {
24+ $Result = " Standards template with id $ID not found"
25+ Write-LogMessage - Headers $Headers - API $APINAME - message $Result - Sev ' Error'
26+ $StatusCode = [HttpStatusCode ]::NotFound
27+ Push-OutputBinding - Name Response - Value ([HttpResponseContext ]@ {
28+ StatusCode = $StatusCode
29+ Body = @ {' Results' = $Result }
30+ })
31+ return
32+ }
33+ $Template = $ClearRow.JSON | ConvertFrom-Json
2334 Remove-AzDataTableEntity - Force @Table - Entity $clearRow
24- $Result = " Removed Standards Template named $ ( $ClearRow .name ) and id $ ( $id ) "
35+ $Result = " Removed Standards Template named $ ( $Template .templateName ) ( $ ( $id ) )"
2536 Write-LogMessage - Headers $Headers - API $APINAME - message $Result - Sev ' Info'
2637 $StatusCode = [HttpStatusCode ]::OK
2738 } catch {
You can’t perform that action at this time.
0 commit comments