Skip to content

Commit f901470

Browse files
Merge pull request KelvinTegelaar#1394 from kris6673/fix-mailboxes-page
Fix: Mailboxes page not loading and sync ListMailboxes select statements
2 parents 004e816 + ce3cdaf commit f901470

File tree

2 files changed

+24
-14
lines changed

2 files changed

+24
-14
lines changed

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ Function Invoke-ListMailboxes {
6363
@{ Name = 'recipientType'; Expression = { $_.'RecipientType' } },
6464
@{ Name = 'recipientTypeDetails'; Expression = { $_.'RecipientTypeDetails' } },
6565
@{ Name = 'AdditionalEmailAddresses'; Expression = { ($_.'EmailAddresses' | Where-Object { $_ -clike 'smtp:*' }).Replace('smtp:', '') -join ', ' } },
66-
@{Name = 'ForwardingSmtpAddress'; Expression = { $_.'ForwardingSmtpAddress' -replace 'smtp:', '' } },
67-
@{Name = 'InternalForwardingAddress'; Expression = { $_.'ForwardingAddress' } },
66+
@{ Name = 'ForwardingSmtpAddress'; Expression = { $_.'ForwardingSmtpAddress' -replace 'smtp:', '' } },
67+
@{ Name = 'InternalForwardingAddress'; Expression = { $_.'ForwardingAddress' } },
6868
DeliverToMailboxAndForward,
6969
HiddenFromAddressListsEnabled,
7070
ExternalDirectoryObjectId,
@@ -77,6 +77,8 @@ Function Invoke-ListMailboxes {
7777
ComplianceTagHoldApplied,
7878
RetentionHoldEnabled,
7979
InPlaceHolds
80+
# This select also exists in ListUserMailboxDetails and should be updated if this is changed here
81+
8082

8183
$StatusCode = [HttpStatusCode]::OK
8284
} catch {

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

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -178,9 +178,9 @@ function Invoke-ListUserMailboxDetails {
178178
}
179179

180180
# Parse InPlaceHolds to determine hold types if avaliable
181-
$InPlaceHold = $false
182-
$EDiscoveryHold = $false
183-
$PurviewRetentionHold = $false
181+
$InPlaceHold = $false
182+
$EDiscoveryHold = $false
183+
$PurviewRetentionHold = $false
184184
$ExcludedFromOrgWideHold = $false
185185

186186
# Check if InPlaceHolds property exists and has values
@@ -192,10 +192,10 @@ function Invoke-ListUserMailboxDetails {
192192
}
193193
# In-Place Hold - no prefix or starts with cld
194194
# Check if it doesn't match any of the other known prefixes
195-
elseif (($hold -like 'cld*' -or
196-
($hold -notlike 'UniH*' -and
197-
$hold -notlike 'mbx*' -and
198-
$hold -notlike 'skp*' -and
195+
elseif (($hold -like 'cld*' -or
196+
($hold -notlike 'UniH*' -and
197+
$hold -notlike 'mbx*' -and
198+
$hold -notlike 'skp*' -and
199199
$hold -notlike '-mbx*'))) {
200200
$InPlaceHold = $true
201201
}
@@ -240,20 +240,28 @@ function Invoke-ListUserMailboxDetails {
240240
AutoExpandingArchive = $AutoExpandingArchiveEnabled
241241
RecipientTypeDetails = $MailboxDetailedRequest.RecipientTypeDetails
242242
Mailbox = $MailboxDetailedRequest
243-
MailboxActionsData = ($MailboxDetailedRequest | Select-Object id, ExchangeGuid, ArchiveGuid, WhenSoftDeleted, @{ Name = 'UPN'; Expression = { $_.'UserPrincipalName' } },
243+
MailboxActionsData = ($MailboxDetailedRequest | Select-Object id, ExchangeGuid, ArchiveGuid, WhenSoftDeleted,
244+
@{ Name = 'UPN'; Expression = { $_.'UserPrincipalName' } },
244245
@{ Name = 'displayName'; Expression = { $_.'DisplayName' } },
245246
@{ Name = 'primarySmtpAddress'; Expression = { $_.'PrimarySMTPAddress' } },
246247
@{ Name = 'recipientType'; Expression = { $_.'RecipientType' } },
247248
@{ Name = 'recipientTypeDetails'; Expression = { $_.'RecipientTypeDetails' } },
248249
@{ Name = 'AdditionalEmailAddresses'; Expression = { ($_.'EmailAddresses' | Where-Object { $_ -clike 'smtp:*' }).Replace('smtp:', '') -join ', ' } },
249-
@{Name = 'ForwardingSmtpAddress'; Expression = { $_.'ForwardingSmtpAddress' -replace 'smtp:', '' } },
250-
@{Name = 'InternalForwardingAddress'; Expression = { $_.'ForwardingAddress' } },
250+
@{ Name = 'ForwardingSmtpAddress'; Expression = { $_.'ForwardingSmtpAddress' -replace 'smtp:', '' } },
251+
@{ Name = 'InternalForwardingAddress'; Expression = { $_.'ForwardingAddress' } },
251252
DeliverToMailboxAndForward,
252253
HiddenFromAddressListsEnabled,
253254
ExternalDirectoryObjectId,
254255
MessageCopyForSendOnBehalfEnabled,
255-
MessageCopyForSentAsEnabled)
256-
} # Select statement taken from ListMailboxes to save a EXO request
256+
MessageCopyForSentAsEnabled,
257+
LitigationHoldEnabled,
258+
LitigationHoldDate,
259+
LitigationHoldDuration,
260+
@{ Name = 'LicensedForLitigationHold'; Expression = { ($_.PersistedCapabilities -contains 'BPOS_S_DlpAddOn' -or $_.PersistedCapabilities -contains 'BPOS_S_Enterprise') } },
261+
ComplianceTagHoldApplied,
262+
RetentionHoldEnabled,
263+
InPlaceHolds)
264+
} # Select statement taken from ListMailboxes to save a EXO request. If updated here, update in ListMailboxes as well.
257265

258266
Push-OutputBinding -Name Response -Value ([HttpResponseContext]@{
259267
StatusCode = [HttpStatusCode]::OK

0 commit comments

Comments
 (0)