Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #3498 #3520

Merged
merged 1 commit into from
Jul 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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