Skip to content

Commit

Permalink
Add tenant level check for if AEA is enabled
Browse files Browse the repository at this point in the history
Also remove a redundant command to make it more BRRR
  • Loading branch information
kris6673 committed Dec 3, 2023
1 parent 2142b7f commit f80f58a
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,18 @@ Function Invoke-ListUserMailboxDetails {
}
$MailboxDetailedRequest = New-ExoRequest -TenantID $TenantFilter -cmdlet 'Get-Mailbox' -cmdParams $FetchParam
try {
$Archive = New-ExoRequest -TenantID $TenantFilter -cmdlet 'Get-Mailbox' -cmdParams $FetchParam
if ($Archive.ArchiveStatus -eq 'Active') {
if ($MailboxDetailedRequest.ArchiveStatus -eq 'Active') {
$ArchiveEnabled = $True
} else {
$ArchiveEnabled = $False
}
# Get organization config of auto expanding archive if it's disabled on user level
if (!$MailboxDetailedRequest.AutoExpandingArchiveEnabled -and $ArchiveEnabled) {
$OrgConfig = New-ExoRequest -TenantID $TenantFilter -cmdlet 'Get-OrganizationConfig'
$AutoExpandingArchiveEnabled = $OrgConfig.AutoExpandingArchiveEnabled
} else {
$AutoExpandingArchiveEnabled = $MailboxDetailedRequest.AutoExpandingArchiveEnabled
}

$FetchParam = @{
Identity = $MailRequest.PrimarySmtpAddress
Expand Down Expand Up @@ -116,7 +122,7 @@ Function Invoke-ListUserMailboxDetails {
TotalArchiveItemCount = [math]::Round($ArchiveSize.ItemCount, 2)
BlockedForSpam = $BlockedForSpam
ArchiveMailBox = $ArchiveEnabled
AutoExpandingArchive = $Archive.AutoExpandingArchiveEnabled
AutoExpandingArchive = $AutoExpandingArchiveEnabled
RecipientTypeDetails = $MailboxDetailedRequest.RecipientTypeDetails
}
} else {
Expand All @@ -140,7 +146,7 @@ Function Invoke-ListUserMailboxDetails {
TotalArchiveItemCount = 0
BlockedForSpam = $BlockedForSpam
ArchiveMailBox = $ArchiveEnabled
AutoExpandingArchive = $Archive.AutoExpandingArchiveEnabled
AutoExpandingArchive = $AutoExpandingArchiveEnabled
RecipientTypeDetails = $MailboxDetailedRequest.RecipientTypeDetails
}
}
Expand Down

0 comments on commit f80f58a

Please sign in to comment.