Exchange On-Premises Shared Mailbox Integration
This document describes the preparation of a local Microsoft Exchange Server environment for EWS-based integrations. The setup uses Active Directory Domain Services and a locally hosted Exchange Server instance running inside a Windows Server.
Step 1. Install Exchange Server
Download Exchange Server:
Microsoft Exchange Server Download
Open PowerShell as Administrator and run the following commands one by one:
Prepare Schema
Section titled “Prepare Schema”.\Setup.exe /PrepareSchema /IAcceptExchangeServerLicenseTerms_DiagnosticDataOFFPrepare Active Directory
Section titled “Prepare Active Directory”.\Setup.exe /PrepareAD /OrganizationName:"LabOrg" /IAcceptExchangeServerLicenseTerms_DiagnosticDataOFFPrepare All Domains
Section titled “Prepare All Domains”.\Setup.exe /PrepareAllDomains /IAcceptExchangeServerLicenseTerms_DiagnosticDataOFFInstall Exchange
Section titled “Install Exchange”.\Setup.exe /Mode:Install /Roles:Mailbox /IAcceptExchangeServerLicenseTerms_DiagnosticDataOFFThe installation typically takes 30–60 minutes.
Restart the server after installation completes.
Step 2. Verify Exchange Installation
Section titled “Step 2. Verify Exchange Installation”Check Exchange services: Get-Service *Exchange*
Most Exchange services should be in the Running state, including services related to Active Directory topology, transport, information store, frontend transport, search, and RPC client access.
Some services such as POP3 or IMAP4 may remain stopped if they are not configured or required.
Verify EWS
Section titled “Verify EWS”Open: https://localhost/EWS/Exchange.asmx
This confirms that Exchange Web Services (EWS) is available.
Verify Exchange Admin Center
Section titled “Verify Exchange Admin Center”Open: https://localhost/ecp
Verify Outlook Web App
Open:https://localhost/owa
Step 3. Create a Shared Mailbox
Section titled “Step 3. Create a Shared Mailbox”Open Exchange Management Shell and create the shared mailbox:
New-Mailbox -Shared -Name "TestShared" -Alias TestSharedGrant Full Access permissions:
Add-MailboxPermission -Identity TestShared -User Administrator -AccessRights FullAccessGrant Send As permissions:
Add-ADPermission TestShared -User Administrator -ExtendedRights "Send As"Step 4. Exchange Web Services (EWS)
Exchange Web Services (EWS) is a SOAP-based API used for integrations with Microsoft Exchange Server on-premises environments.
Typical EWS endpoint:https://localhost/EWS/Exchange.asmx
EWS can be used for:
- Reading and sending emails
- Shared mailbox access
- Calendar management
- Attachment handling
- Mailbox impersonation
- NTLM and Basic authentication
- Service integrations
Applications written in Node.js, C#, Python, or PowerShell can communicate with Exchange through this endpoint.
Step 5. Prepare Certificates for Node.js Integration
Section titled “Step 5. Prepare Certificates for Node.js Integration”The Exchange certificate must be exported from the Exchange server and trusted on the application machine.
Export Exchange Certificate
Section titled “Export Exchange Certificate”
Open Exchange Management Shell and list certificates:
Get-ExchangeCertificate | fl Thumbprint,Subject,CertificateDomains,ServicesCreate export directory:
New-Item -ItemType Directory -Path C:\Temp -Force | Out-NullExport the certificate (Windows):
$thumb = "6ECFA8EDB06AD8EC06F180EBF2DFAA4FC23A245D"$cert = Get-Item "Cert:\LocalMachine\My\$thumb"
[System.IO.File]::WriteAllBytes( "C:\Temp\exch-srv.cer", $cert.Export([System.Security.Cryptography.X509Certificates.X509ContentType]::Cert))Copy the .cer file to the local machine.

Trust the Certificate
Section titled “Trust the Certificate”Run on the local machine:
certutil -addstore -f Root "C:\certs\exch-srv.cer"