Skip to content

Commit a851931

Browse files
authored
Merge pull request KelvinTegelaar#1564 from kris6673/fix-archive-and-blockedForSpam
Fix: Fix blocked for spam parameters and logic
2 parents 2c5679e + 2a820fd commit a851931

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ListUserMailboxDetails.ps1

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ function Invoke-ListUserMailboxDetails {
1818
# Interact with query parameters or the body of the request.
1919
$TenantFilter = $Request.Query.tenantFilter
2020
$UserID = $Request.Query.UserID
21+
$UserMail = $Request.Query.userMail
22+
Write-Host "TenantFilter: $TenantFilter"
23+
Write-Host "UserID: $UserID"
24+
Write-Host "UserMail: $UserMail"
2125

2226
try {
2327
$Requests = @(
@@ -53,7 +57,7 @@ function Invoke-ListUserMailboxDetails {
5357
@{
5458
CmdletInput = @{
5559
CmdletName = 'Get-BlockedSenderAddress'
56-
Parameters = @{ Identity = $UserID }
60+
Parameters = @{ SenderAddress = $UserMail }
5761
}
5862
},
5963
@{
@@ -63,7 +67,6 @@ function Invoke-ListUserMailboxDetails {
6367
}
6468
}
6569
)
66-
Write-Host $UserID
6770
$usernames = New-GraphGetRequest -tenantid $TenantFilter -uri 'https://graph.microsoft.com/beta/users?$select=id,userPrincipalName,displayName,mailNickname&$top=999'
6871
$Results = New-ExoBulkRequest -TenantId $TenantFilter -CmdletArray $Requests -returnWithCommand $true -Anchor $username
6972
Write-Host "First line of usernames is $($usernames[0] | ConvertTo-Json)"
@@ -105,9 +108,9 @@ function Invoke-ListUserMailboxDetails {
105108

106109
# Determine if the user is blocked for spam
107110
if ($BlockedSender -and $BlockedSender.Count -gt 0) {
108-
$BlockedForSpam = $false
109-
} else {
110111
$BlockedForSpam = $true
112+
} else {
113+
$BlockedForSpam = $false
111114
}
112115
} catch {
113116
Write-Error "Failed Fetching Data $($_.Exception.message): $($_.InvocationInfo.ScriptLineNumber)"

Modules/CIPPCore/Public/GraphHelper/New-ExoRequest.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ function New-ExoRequest {
44
Internal
55
#>
66
[CmdletBinding(DefaultParameterSetName = 'ExoRequest')]
7-
Param(
7+
param(
88
[Parameter(Mandatory = $true, ParameterSetName = 'ExoRequest')]
99
[string]$cmdlet,
1010

@@ -43,7 +43,7 @@ function New-ExoRequest {
4343
$token = Get-GraphToken -Tenantid $tenantid -scope "$Resource/.default" -AsApp:$AsApp.IsPresent
4444

4545
if ($cmdParams) {
46-
#if cmdparams is a pscustomobject, convert to hashtable, otherwise leave as is
46+
#if cmdParams is a pscustomobject, convert to hashtable, otherwise leave as is
4747
$Params = $cmdParams
4848
} else {
4949
$Params = @{}
@@ -145,7 +145,7 @@ function New-ExoRequest {
145145
} until ($null -eq $URL)
146146

147147
Write-Verbose ($ResponseHeaders | ConvertTo-Json)
148-
if ($ReturnedData.'@adminapi.warnings' -and $ReturnedData.value -eq $null) {
148+
if ($ReturnedData.'@adminapi.warnings' -and $null -eq $ReturnedData.value) {
149149
$ReturnedData.value = $ReturnedData.'@adminapi.warnings'
150150
}
151151
} catch {

cspell.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"dictionaryDefinitions": [],
55
"dictionaries": [],
66
"words": [
7+
"adminapi",
78
"ADMS",
89
"AITM",
910
"Autotask",
@@ -23,6 +24,7 @@
2324
"gdap",
2425
"GDAP",
2526
"IMAP",
27+
"innererror",
2628
"Intune",
2729
"locationcipp",
2830
"MAPI",

0 commit comments

Comments
 (0)