Skip to content

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:

.\Setup.exe /PrepareSchema /IAcceptExchangeServerLicenseTerms_DiagnosticDataOFF
.\Setup.exe /PrepareAD /OrganizationName:"LabOrg" /IAcceptExchangeServerLicenseTerms_DiagnosticDataOFF
.\Setup.exe /PrepareAllDomains /IAcceptExchangeServerLicenseTerms_DiagnosticDataOFF
.\Setup.exe /Mode:Install /Roles:Mailbox /IAcceptExchangeServerLicenseTerms_DiagnosticDataOFF

The installation typically takes 30–60 minutes.

Restart the server after installation completes.

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.

Open: https://localhost/EWS/Exchange.asmx

This confirms that Exchange Web Services (EWS) is available.

Open: https://localhost/ecp

Verify Outlook Web App

Open:https://localhost/owa

Open Exchange Management Shell and create the shared mailbox:

New-Mailbox -Shared -Name "TestShared" -Alias TestShared

Grant Full Access permissions:

Add-MailboxPermission -Identity TestShared -User Administrator -AccessRights FullAccess

Grant 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.

Screenshot

Open Exchange Management Shell and list certificates:

Get-ExchangeCertificate | fl Thumbprint,Subject,CertificateDomains,Services

Create export directory:

New-Item -ItemType Directory -Path C:\Temp -Force | Out-Null

Export 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.

Screenshot

Run on the local machine:

certutil -addstore -f Root "C:\certs\exch-srv.cer"

Screenshot