From d8febaa222c4b2d7f0738aef1e9e79058cf24e19 Mon Sep 17 00:00:00 2001
From: SirTrek <4106300+SirTrek@users.noreply.github.com>
Date: Wed, 8 Jul 2026 14:07:32 -0600
Subject: [PATCH 1/7] Extend Edit Remote Mailbox page with alias and GAL
management
The existing editremotemailbox page (GET/POST) only edited DisplayName,
PrimarySmtpAddress-as-identity, Alias (mail nickname), and
RemoteRoutingAddress. It had no way to manage secondary SMTP proxy
addresses or GAL visibility.
Adds:
- An Email Addresses card listing all EmailAddresses proxy addresses,
with a modal to add a new alias (Set-RemoteMailbox -EmailAddresses
@{Add=...}) and a Remove button per alias (@{Remove=...})
- A Hidden from Address Lists card with a one-click toggle for
HiddenFromAddressListsEnabled
Both actions post back to /editremotemailbox with an Action field, and
the page re-renders with the mailbox's current state afterwards.
Factored the shared rendering logic (used by GET and by every POST
action) into Get-RemoteMailboxEditPage to avoid duplicating the
proxy-address/GAL-badge HTML building four times.
---
Start-ExchangeRecipientAdminCenter.ps1 | 120 +++++++++++++++++++---
web/editremotemailbox.html | 131 ++++++++++++++++++++-----
2 files changed, 218 insertions(+), 33 deletions(-)
diff --git a/Start-ExchangeRecipientAdminCenter.ps1 b/Start-ExchangeRecipientAdminCenter.ps1
index 9955ee4..cf9defb 100644
--- a/Start-ExchangeRecipientAdminCenter.ps1
+++ b/Start-ExchangeRecipientAdminCenter.ps1
@@ -35,6 +35,82 @@ $MIMEHASH = @{".avi" = "video/x-msvideo"; ".crt" = "application/x-x509-ca-cert";
$HTML_SUCCESS = "
{result}
"
$HTML_WARN = "
{result}
"
+function Get-RemoteMailboxEditPage {
+ # Renders editremotemailbox.html for a given mailbox identity. Shared by the
+ # GET (initial view) and POST (after an update) handlers below.
+ param(
+ [Parameter(Mandatory)][string]$Identity,
+ [string]$ResultHtml = ""
+ )
+
+ $Mailbox = Get-RemoteMailbox -Identity $Identity -ErrorAction SilentlyContinue
+
+ if (-not $Mailbox) {
+ return "Remote mailbox '$($Identity)' not found"
+ }
+
+ # Accepted domain list, used for the "add alias" domain picker
+ $HTMLROWS_AD = ""
+ foreach ($Item in (Get-AcceptedDomain)) {
+ $HTMLROWS_AD += "`n"
+ }
+
+ # Proxy address (EmailAddresses) rows, each with a remove button
+ $HTMLROWS_PROXY = ""
+ foreach ($Addr in $Mailbox.EmailAddresses) {
+ $AddrString = $Addr.ToString()
+ $IsPrimary = $AddrString.StartsWith("SMTP:")
+ if ($IsPrimary) {
+ $Badge = "Primary"
+ $RemoveBtn = ""
+ }
+ else {
+ $Badge = "Alias"
+ $RemoveBtn = "
+ "
+ }
+ $HTMLROWS_PROXY += "
+