Skip to content

Commit

Permalink
Merge pull request KelvinTegelaar#508 from kris6673/auto-expanding-ar…
Browse files Browse the repository at this point in the history
…chive

Add a check if AEA is enabled on organisation level
  • Loading branch information
KelvinTegelaar authored Dec 8, 2023
2 parents 8da70e0 + f80f58a commit 77f3019
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 77f3019

Please sign in to comment.