Skip to content

Commit 2e06bbb

Browse files
Merge branch 'dev' of https://github.com/KelvinTegelaar/CIPP-API into dev
2 parents 026f259 + 4b8a24b commit 2e06bbb

File tree

2 files changed

+57
-0
lines changed

2 files changed

+57
-0
lines changed
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
function Get-CIPPAlertQuarantineReleaseRequests {
2+
<#
3+
.FUNCTIONALITY
4+
Entrypoint
5+
#>
6+
[CmdletBinding()]
7+
param (
8+
[Parameter(Mandatory = $false)]
9+
[Alias('input')]
10+
$InputValue,
11+
$TenantFilter
12+
)
13+
14+
$HasLicense = Test-CIPPStandardLicense -StandardName 'QuarantineReleaseRequests' -TenantFilter $TenantFilter -RequiredCapabilities @(
15+
'EXCHANGE_S_STANDARD',
16+
'EXCHANGE_S_ENTERPRISE',
17+
'EXCHANGE_S_STANDARD_GOV',
18+
'EXCHANGE_S_ENTERPRISE_GOV',
19+
'EXCHANGE_LITE'
20+
)
21+
22+
if (-not $HasLicense) {
23+
return
24+
}
25+
26+
try {
27+
$RequestedReleases = New-ExoRequest -tenantid $TenantFilter -cmdlet 'Get-QuarantineMessage' -cmdParams @{ PageSize = 1000; ReleaseStatus = 'Requested' } -ErrorAction Stop | Select-Object -ExcludeProperty *data.type*
28+
29+
if ($RequestedReleases) {
30+
# Get the CIPP URL for the Quarantine link
31+
$CippConfigTable = Get-CippTable -tablename Config
32+
$CippConfig = Get-CIPPAzDataTableEntity @CippConfigTable -Filter "PartitionKey eq 'InstanceProperties' and RowKey eq 'CIPPURL'"
33+
$CIPPUrl = 'https://{0}' -f $CippConfig.Value
34+
35+
$AlertData = foreach ($Message in $RequestedReleases) {
36+
[PSCustomObject]@{
37+
Identity = $Message.Identity
38+
MessageId = $Message.MessageId
39+
Subject = $Message.Subject
40+
SenderAddress = $Message.SenderAddress
41+
RecipientAddress = $Message.RecipientAddress
42+
Type = $Message.Type
43+
PolicyName = $Message.PolicyName
44+
ReleaseStatus = $Message.ReleaseStatus
45+
ReceivedTime = $Message.ReceivedTime
46+
QuarantineViewUrl = "$CIPPUrl/email/administration/quarantine?tenantFilter=$TenantFilter"
47+
Tenant = $TenantFilter
48+
}
49+
}
50+
51+
Write-AlertTrace -cmdletName $MyInvocation.MyCommand -tenantFilter $TenantFilter -data $AlertData
52+
}
53+
} catch {
54+
Write-AlertMessage -tenant $TenantFilter -message "QuarantineReleaseRequests: $(Get-NormalizedError -message $_.Exception.Message)"
55+
}
56+
}

cspell.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"CIPP-API",
1515
"CIPPCPV",
1616
"CIPPGDAP",
17+
"CIPPURL",
1718
"Connectwise",
1819
"CPIM",
1920
"Datto",

0 commit comments

Comments
 (0)