Skip to content

Commit

Permalink
Merge pull request #3520 from NikCharlebois/Fix3498
Browse files Browse the repository at this point in the history
Fixes #3498
  • Loading branch information
NikCharlebois committed Jul 28, 2023
2 parents 741f5a3 + 5ed7542 commit 3492987
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
FIXES [#3518](https://github.com/microsoft/Microsoft365DSC/issues/3518)
* O365OrgSettings
* Added error handling for the Viva settings to handle task cancellation errors.
* SCComplianceSearchAction
* Adds support for the Preview action type.
FIXES [#3498](https://github.com/microsoft/Microsoft365DSC/issues/3498)
* MISC
* M365DscReverse: Fix exporting when $Filter var exists locally
FIXES [#3515](https://github.com/microsoft/Microsoft365DSC/issues/3515)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ function Get-TargetResource
$IncludeSP = Get-ResultProperty -ResultString $currentAction.Results -PropertyName 'Include SharePoint versions'
$ScopeValue = Get-ResultProperty -ResultString $currentAction.Results -PropertyName 'Scope'

$ActionName = 'Export'
$ActionName = $Action
if ('RetentionReports' -eq $Scenario)
{
$ActionName = 'Retention'
Expand All @@ -143,6 +143,10 @@ function Get-TargetResource
CertificatePassword = $CertificatePassword
Ensure = 'Present'
}
if ($ActionName -eq 'Preview')
{
$result.Remove('EnableDedupe') | Out-Null
}
}
else
{
Expand Down Expand Up @@ -317,10 +321,17 @@ function Set-TargetResource
'Purge'
{
$CreationParams.Add('Purge', $true)
$CreationParams.Remove('ActionScope')
$CreationParams.Remove('Scope')
$CreationParams.Remove('ActionScope') | Out-Null
$CreationParams.Remove('Scope') | Out-Null
$CreationParams.Add('Confirm', $false)
}
'Preview'
{
$CreationParams.Add('Preview', $true)
$CreationParams.Remove("Scope") | Out-Null
$CreationParams.Add('Confirm', $false)
$CreationParams.Remove('EnableDedupe') | Out-Null
}
}

$CreationParams.Remove('Action')
Expand Down Expand Up @@ -687,7 +698,6 @@ function Get-CurrentAction

[Parameter(Mandatory = $true)]
[System.String]
[ValidateSet('Export', 'Purge', 'Retention')]
$Action
)
# For the sake of retrieving the current action, search by Action = Export;
Expand Down Expand Up @@ -719,14 +729,18 @@ function Get-CurrentAction
$currentAction = Get-ComplianceSearchAction | Where-Object { $_.SearchName -eq $SearchName -and $_.Action -eq $Action }
}

if ('Purge' -ne $Action -and $null -ne $currentAction)
if ('Purge' -ne $Action -and $null -ne $currentAction -and -not [System.String]::IsNullOrEmpty($Scenario))
{
$currentAction = $currentAction | Where-Object { $_.Results -like "*Scenario: $($Scenario)*" }
}
elseif ('Purge' -eq $Action)
{
$currentAction = $currentAction | Where-Object { $_.Action -eq 'Purge' }
}
elseif ('Preview' -eq $Action)
{
$currentAction = $currentAction | Where-Object { $_.Action -eq 'Preview' }
}

return $currentAction
}
Expand Down

0 comments on commit 3492987

Please sign in to comment.