Skip to content

Add Remote Mailbox properties/alias/GAL/routing-address management#11

Open
SirTrek wants to merge 3 commits into
spgoodman:mainfrom
SirTrek:feature/remote-mailbox-edit
Open

Add Remote Mailbox properties/alias/GAL/routing-address management#11
SirTrek wants to merge 3 commits into
spgoodman:mainfrom
SirTrek:feature/remote-mailbox-edit

Conversation

@SirTrek

@SirTrek SirTrek commented Jul 8, 2026

Copy link
Copy Markdown

Summary

The Remote Mailboxes list already links each row to /editremotemailbox?id=..., but that route and page didn't exist, so clicking a mailbox 404'd. This PR fills that gap and adds the ability to manage the attributes that aren't exposed anywhere else in the tool:

  • View a Remote Mailbox's Name, PrimarySmtpAddress, and RemoteRoutingAddress
  • Add or remove proxy addresses (EmailAddresses aliases)
  • Toggle HiddenFromAddressListsEnabled (hide/unhide from the GAL)
  • Change RemoteRoutingAddress
  • Disable a Remote Mailbox (Disable-RemoteMailbox), behind a type-to-confirm control that requires typing the mailbox's PrimarySmtpAddress before the button enables, checked server-side too so it can't be bypassed client-side

It follows the app's existing conventions exactly: plain GET forms (no JS/AJAX beyond the type-to-confirm check), server-side HTML placeholder templating, and the on-prem Recipient Management Tools snap-in already loaded by the script — no new dependencies.

A second, unrelated commit fixes a robustness bug found while testing: the whole request loop ran inside a single try/finally with no catch, so any exception writing a response (e.g. a client closing the connection mid-response) crashed the entire webserver for all users. Each request is now handled in its own try/catch.

A third commit adds the disable-mailbox capability above, and wraps the page's feather.replace() call in try/catch as cheap insurance against icon-library issues blocking the confirm-button script (not an active bug here since this branch vendors feather-icons locally rather than loading it from an unpinned CDN, but harmless and consistent with the same defensive fix I made on a similar page targeting dev).

Test plan

  • Parser]::ParseFile clean (no PowerShell syntax errors)
  • Manually verified against a live on-prem Exchange Management Tools install (view properties, add/remove aliases, toggle HiddenFromAddressListsEnabled, change RemoteRoutingAddress) — confirmed working
  • Confirmed the pre-existing dangling /editremotemailbox?id=... link now resolves instead of 404ing
  • Disable-mailbox flow (type-to-confirm + Disable-RemoteMailbox) has been verified on an equivalent page on my dev-targeted branch, but not yet re-tested on this specific branch after porting — I'll confirm and check this box once done

SirTrek added 2 commits July 8, 2026 13:57
The Remote Mailboxes list already linked to /editremotemailbox?id=...
but that route and page did not exist, so clicking a mailbox 404'd.

Adds a GET /editremotemailbox route plus web/editremotemailbox.html to:
- View a mailbox's Name, PrimarySmtpAddress, and RemoteRoutingAddress
- Add or remove proxy addresses (EmailAddresses aliases)
- Toggle HiddenFromAddressListsEnabled
- Change RemoteRoutingAddress

Follows the existing pattern used by the other sections: plain GET
forms, server-side HTML templating, and the on-prem Recipient
Management Tools snap-in already loaded by the script.
The whole request loop ran inside one try/finally with no catch, so
any exception writing a response (e.g. the client closes the
connection or navigates away before the write completes, surfacing
as "The specified network name is no longer available") propagated
out of the while loop and killed the entire listener for all users.

Wraps each request's handling in its own try/catch so a single failed
request is logged and the server keeps listening.
@SirTrek

SirTrek commented Jul 8, 2026

Copy link
Copy Markdown
Author

Update: this has now been tested against a live on-prem Exchange Management Tools install (Get-RemoteMailbox/Set-RemoteMailbox for viewing properties, adding/removing aliases, toggling HiddenFromAddressListsEnabled, and changing RemoteRoutingAddress) and works as expected.

Adds a "Danger Zone" card to the Edit Remote Mailbox page with a
type-to-confirm control (must type the mailbox's PrimarySmtpAddress
before the Disable button enables) backed by a server-side check of
the same confirmation text, since the client-side JS is trivially
bypassable.

Disable-RemoteMailbox strips the Exchange attributes from the AD
object; it does not delete the Exchange Online mailbox itself. Since
the mailbox no longer exists afterward, the GET handler renders the
Remote Mailboxes list directly instead of a 404 edit page for an
identity that's gone.

Also wraps feather.replace() in try/catch as cheap insurance against
icon-library hiccups blocking the confirm-button script - not an
active bug on this branch (feather-icons is vendored locally here,
not loaded from an unpinned CDN like on the dev branch), but harmless
and consistent with the dev-branch fix for the same page.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant