Skip to content

Commit 1e1cdf4

Browse files
Merge pull request KelvinTegelaar#1732 from kris6673/queues
Fix: Loading issue for ListMailQuarantine with allTenants
2 parents 80af0d8 + 5d9c443 commit 1e1cdf4

File tree

4 files changed

+7
-23
lines changed

4 files changed

+7
-23
lines changed

Modules/CIPPCore/Public/Entrypoints/Activity Triggers/Push-ListMailQuarantineAllTenants.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
try {
1414
$quarantineMessages = New-ExoRequest -tenantid $domainName -cmdlet 'Get-QuarantineMessage' -cmdParams @{ 'PageSize' = 1000 } | Select-Object -ExcludeProperty *data.type*
15-
$GraphRequest = foreach ($message in $quarantineMessages) {
15+
foreach ($message in $quarantineMessages) {
1616
$messageData = @{
1717
QuarantineMessage = [string]($message | ConvertTo-Json -Depth 10 -Compress)
1818
RowKey = [string](New-Guid).Guid

Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ListMailboxRules.ps1

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,6 @@ function Invoke-ListMailboxRules {
3131
QueueMessage = "Still loading data for $TenantFilter. Please check back in a few more minutes"
3232
QueueId = $RunningQueue.RowKey
3333
}
34-
[PSCustomObject]@{
35-
Waiting = $true
36-
}
3734
} elseif ((!$Rows -and !$RunningQueue) -or ($TenantFilter -eq 'AllTenants' -and ($Rows | Measure-Object).Count -eq 1)) {
3835
Write-Information "No cached mailbox rules found for $TenantFilter, starting new orchestration"
3936
if ($TenantFilter -eq 'AllTenants') {
@@ -58,7 +55,7 @@ function Invoke-ListMailboxRules {
5855
SkipLog = $true
5956
}
6057
#Write-Host ($InputObject | ConvertTo-Json)
61-
$InstanceId = Start-NewOrchestration -FunctionName 'CIPPOrchestrator' -InputObject ($InputObject | ConvertTo-Json -Depth 5 -Compress)
58+
Start-NewOrchestration -FunctionName 'CIPPOrchestrator' -InputObject ($InputObject | ConvertTo-Json -Depth 5 -Compress)
6259
Write-Host "Started mailbox rules orchestration with ID = '$InstanceId'"
6360
}
6461

Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Spamfilter/Invoke-ListMailQuarantine.ps1

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,13 @@ function Invoke-ListMailQuarantine {
1919
$Filter = "PartitionKey eq '$PartitionKey'"
2020
$Rows = Get-CIPPAzDataTableEntity @Table -filter $Filter | Where-Object -Property Timestamp -GT (Get-Date).AddMinutes(-30)
2121
$QueueReference = '{0}-{1}' -f $TenantFilter, $PartitionKey
22-
$RunningQueue = Invoke-ListCippQueue | Where-Object { $_.Reference -eq $QueueReference -and $_.Status -notmatch 'Completed' -and $_.Status -notmatch 'Failed' }
22+
$RunningQueue = Invoke-ListCippQueue -Reference $QueueReference | Where-Object { $_.Status -notmatch 'Completed' -and $_.Status -notmatch 'Failed' }
2323
# If a queue is running, we will not start a new one
2424
if ($RunningQueue) {
2525
$Metadata = [PSCustomObject]@{
2626
QueueMessage = 'Still loading data for all tenants. Please check back in a few more minutes'
2727
QueueId = $RunningQueue.RowKey
2828
}
29-
[PSCustomObject]@{
30-
Waiting = $true
31-
}
3229
} elseif (!$Rows -and !$RunningQueue) {
3330
# If no rows are found and no queue is running, we will start a new one
3431
$TenantList = Get-Tenants -IncludeErrors
@@ -49,16 +46,13 @@ function Invoke-ListMailQuarantine {
4946
}
5047
SkipLog = $true
5148
}
52-
Start-NewOrchestration -FunctionName 'CIPPOrchestrator' -InputObject ($InputObject | ConvertTo-Json -Depth 5 -Compress)
53-
[PSCustomObject]@{
54-
Waiting = $true
55-
}
49+
$null = Start-NewOrchestration -FunctionName 'CIPPOrchestrator' -InputObject ($InputObject | ConvertTo-Json -Depth 5 -Compress)
5650
} else {
5751
$Metadata = [PSCustomObject]@{
5852
QueueId = $RunningQueue.RowKey ?? $null
5953
}
60-
$messages = $Rows
61-
foreach ($message in $messages) {
54+
$Messages = $Rows
55+
foreach ($message in $Messages) {
6256
$messageObj = $message.QuarantineMessage | ConvertFrom-Json
6357
$messageObj | Add-Member -NotePropertyName 'Tenant' -NotePropertyValue $message.Tenant -Force
6458
$messageObj

Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Security/Invoke-ExecAlertsList.ps1

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,6 @@ function Invoke-ExecAlertsList {
6262
QueueMessage = 'Still loading data for all tenants. Please check back in a few more minutes'
6363
QueueId = $RunningQueue.RowKey
6464
}
65-
[PSCustomObject]@{
66-
Waiting = $true
67-
}
6865
} elseif (!$Rows -and !$RunningQueue) {
6966
# If no rows are found and no queue is running, we will start a new one
7067
$TenantList = Get-Tenants -IncludeErrors
@@ -85,11 +82,7 @@ function Invoke-ExecAlertsList {
8582
}
8683
SkipLog = $true
8784
} | ConvertTo-Json -Depth 10
88-
$InstanceId = Start-NewOrchestration -FunctionName CIPPOrchestrator -InputObject $InputObject
89-
[PSCustomObject]@{
90-
Waiting = $true
91-
InstanceId = $InstanceId
92-
}
85+
Start-NewOrchestration -FunctionName CIPPOrchestrator -InputObject $InputObject
9386
} else {
9487
$Metadata = [PSCustomObject]@{
9588
QueueId = $RunningQueue.RowKey ?? $null

0 commit comments

Comments
 (0)