Skip to content

Commit 6c9be42

Browse files
committed
Small changes to fit the actions changes in the frontend
1 parent d65ca83 commit 6c9be42

File tree

3 files changed

+22
-9
lines changed

3 files changed

+22
-9
lines changed

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ Function Invoke-ExecHideFromGAL {
1010
[CmdletBinding()]
1111
param($Request, $TriggerMetadata)
1212

13-
$Headers = $Request.Headers
1413
$APIName = $Request.Params.CIPPEndpoint
14+
$Headers = $Request.Headers
1515
Write-LogMessage -Headers $Headers -API $APINAME -message 'Accessed this API' -Sev 'Debug'
1616

1717

@@ -22,19 +22,17 @@ Function Invoke-ExecHideFromGAL {
2222
$HideFromGAL = [System.Convert]::ToBoolean($HideFromGAL)
2323

2424
Try {
25-
$HideResults = Set-CIPPHideFromGAL -tenantFilter $TenantFilter -UserID $UserId -hidefromgal $Hidden -Headers $Request.Headers -APIName $APIName
26-
$Results = [pscustomobject]@{'Results' = $HideResults }
25+
$Result = Set-CIPPHideFromGAL -tenantFilter $TenantFilter -UserID $UserId -hidefromgal $HideFromGAL -Headers $Headers -APIName $APIName
2726
$StatusCode = [HttpStatusCode]::OK
2827

2928
} catch {
30-
$ErrorMessage = Get-CippException -Exception $_
31-
$Results = [pscustomobject]@{'Results' = "Failed. $($ErrorMessage.NormalizedError)" }
29+
$Result = $_.Exception.Message
3230
$StatusCode = [HttpStatusCode]::Forbidden
3331
}
3432
# Associate values to output bindings by calling 'Push-OutputBinding'.
3533
Push-OutputBinding -Name Response -Value ([HttpResponseContext]@{
3634
StatusCode = $StatusCode
37-
Body = $Results
35+
Body = @{ 'Results' = $Result }
3836
})
3937

4038
}

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
@@ -11,10 +11,11 @@ Function Invoke-ListMailboxes {
1111
param($Request, $TriggerMetadata)
1212

1313
$APIName = $Request.Params.CIPPEndpoint
14-
Write-LogMessage -headers $Request.Headers -API $APINAME -message 'Accessed this API' -Sev 'Debug'
14+
$Headers = $Request.Headers
15+
Write-LogMessage -headers $Headers -API $APIName -message 'Accessed this API' -Sev 'Debug'
1516

1617
# Interact with query parameters or the body of the request.
17-
$TenantFilter = $Request.Query.TenantFilter
18+
$TenantFilter = $Request.Query.tenantFilter
1819
try {
1920
$Select = 'id,ExchangeGuid,ArchiveGuid,UserPrincipalName,DisplayName,PrimarySMTPAddress,RecipientType,RecipientTypeDetails,EmailAddresses,WhenSoftDeleted,IsInactiveMailbox,ForwardingSmtpAddress,DeliverToMailboxAndForward,ForwardingAddress,HiddenFromAddressListsEnabled,ExternalDirectoryObjectId,MessageCopyForSendOnBehalfEnabled,MessageCopyForSentAsEnabled'
2021
$ExoRequest = @{
@@ -32,6 +33,7 @@ Function Invoke-ListMailboxes {
3233
@{Parameter = 'PublicFolder'; Type = 'Bool' }
3334
@{Parameter = 'RecipientTypeDetails'; Type = 'String' }
3435
@{Parameter = 'SoftDeletedMailbox'; Type = 'Bool' }
36+
@{Parameter = 'Identity'; Type = 'String' }
3537
)
3638

3739
foreach ($Param in $Request.Query.PSObject.Properties.Name) {

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

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,20 @@ Function Invoke-ListUserMailboxDetails {
183183
AutoExpandingArchive = $AutoExpandingArchiveEnabled
184184
RecipientTypeDetails = $MailboxDetailedRequest.RecipientTypeDetails
185185
Mailbox = $MailboxDetailedRequest
186-
}
186+
MailboxActionsData = ($MailboxDetailedRequest | Select-Object id, ExchangeGuid, ArchiveGuid, WhenSoftDeleted, @{ Name = 'UPN'; Expression = { $_.'UserPrincipalName' } },
187+
@{ Name = 'displayName'; Expression = { $_.'DisplayName' } },
188+
@{ Name = 'primarySmtpAddress'; Expression = { $_.'PrimarySMTPAddress' } },
189+
@{ Name = 'recipientType'; Expression = { $_.'RecipientType' } },
190+
@{ Name = 'recipientTypeDetails'; Expression = { $_.'RecipientTypeDetails' } },
191+
@{ Name = 'AdditionalEmailAddresses'; Expression = { ($_.'EmailAddresses' | Where-Object { $_ -clike 'smtp:*' }).Replace('smtp:', '') -join ', ' } },
192+
@{Name = 'ForwardingSmtpAddress'; Expression = { $_.'ForwardingSmtpAddress' -replace 'smtp:', '' } },
193+
@{Name = 'InternalForwardingAddress'; Expression = { $_.'ForwardingAddress' } },
194+
DeliverToMailboxAndForward,
195+
HiddenFromAddressListsEnabled,
196+
ExternalDirectoryObjectId,
197+
MessageCopyForSendOnBehalfEnabled,
198+
MessageCopyForSentAsEnabled)
199+
} # Select statement taken from ListMailboxes to save a EXO request
187200

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

0 commit comments

Comments
 (0)