Manage Microsoft 365 Shared Mailbox Permissions from Java
Question details
An organization needs to manage shared mailbox Full Access and Send As permissions from a Java application.

- Product
- Microsoft 365 Exchange Online
- Device & OS
- not provided
- Scenario
- Administrators want to grant and remove shared mailbox permissions through an application instead of manually using the Microsoft 365 admin center or Remote PowerShell.
- Observed behavior
- The desired outcome is a secure, programmatic way to administer both permission types.
Identify the shared mailbox and users by their Exchange Online identities, and confirm that the automation identity can be assigned the required Exchange permissions. Check your organization's policies for app authentication and administrative automation.
Use an Exchange Online PowerShell automation backend
Use this approach when a Java application needs to grant or remove shared mailbox permissions through a controlled service.
Have the Java application call an authenticated backend that runs approved Exchange Online PowerShell operations. The backend can use an approved automation service or a PowerShell runspace; do not expose arbitrary PowerShell execution to application users.
Full Access and Send As are separate permissions and must be managed with their respective cmdlets.
Register or configure an automation identity for Exchange Online PowerShell. For app-only authentication, follow Microsoft's current guidance for certificate or managed identity authentication, Exchange.ManageAsApp where applicable, admin consent, and the required Exchange role assignments.
In the automation service or PowerShell runspace, load the ExchangeOnlineManagement module and use Connect-ExchangeOnline with the authentication method configured for the service.
Use Add-MailboxPermission with -Identity, -User, -AccessRights FullAccess, and -InheritanceType All to grant access. Use Remove-MailboxPermission with the mailbox, user, and FullAccess right to remove an explicit grant.
Use Add-RecipientPermission with -Identity, -Trustee, and -AccessRights SendAs to grant Send As. Use Remove-RecipientPermission with the same mailbox, trustee, and access right to remove it.
Call the backend's approved grant or remove operation from Java, validating the mailbox, user, and requested action. Use Get-MailboxPermission and Get-RecipientPermission in the backend to verify the resulting permissions.
Use WPS Office for everyday document work
WPS Office is a free, lightweight alternative for everyday document, spreadsheet, and presentation work. Its familiar interface and Microsoft Office format support make it easier to move existing files, though it does not manage Exchange Online mailbox permissions.

Frequently Asked Questions
Can Java call the Exchange Online permission cmdlets directly?
A Java application can call a secured backend that runs the Exchange Online PowerShell cmdlets. Use an approved automation service or PowerShell runspace rather than allowing Java clients to submit arbitrary commands.
Does Full Access also grant Send As?
No. Manage Full Access with Add-MailboxPermission or Remove-MailboxPermission, and manage Send As separately with Add-RecipientPermission or Remove-RecipientPermission.
How can I check a user's current mailbox permissions?
After connecting with Connect-ExchangeOnline, use Get-MailboxPermission for Full Access entries and Get-RecipientPermission for Send As entries. Review whether an entry is explicit or inherited before attempting to remove it.
What permissions does the automation service need?
The service needs an authentication method supported by Exchange Online PowerShell and appropriate Exchange role assignments. For app-only access, follow Microsoft's current guidance on Exchange.ManageAsApp, admin consent, and the chosen certificate or managed identity setup.




