How to Create a Shared Mailbox Using Microsoft Graph

h l 0 Reputation points
2025-11-05T08:55:44.7833333+00:00

As a Java developer integrating Microsoft Graph with Spring Boot, I need to create a shared mailbox but haven't found a relevant API. Are there any APIs available to add a shared mailbox directly without creating a user? I have already registered an application and obtained the relevant clientId, clientSecret, and other necessary information.

Relevant dependency versions:

java 21

<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.5.6</version>
<microsoft.graph.version>6.55.0</microsoft.graph.version>
<!-- microsoft -->
<dependency>
    <groupId>com.microsoft.graph</groupId>
    <artifactId>microsoft-graph</artifactId>
    <version>${microsoft.graph.version}</version>
</dependency>
<dependency>
    <groupId>com.microsoft.graph</groupId>
    <artifactId>microsoft-graph-beta</artifactId>
    <version>${microsoft.graph-beta.version}</version>
</dependency>
<dependency>
    <groupId>com.azure</groupId>
    <artifactId>azure-identity</artifactId>
    <version>${azure.identity.version}</version>
</dependency>


Could your team provide me with an API documentation? Or are there any other solution ideas? I do not want to assign licenses to users for creating mailboxes.

Please reply as soon as possible. Thank you.

Developer technologies | C#
Developer technologies | C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Adiba Khan 1,440 Reputation points Microsoft External Staff
    2025-11-05T09:48:46.4866667+00:00

    Thank you for reaching out. I understand that you would like to create a shared mailbox using Microsoft graph API within a spring boot application.

    Currently, Microsoft graph API does not directly support creating shared mailboxes. Shared mailboxes can only be created via exchange online PowerShell or exchange admin center(EAC) not via graph API.

    Once a shared mailbox has been created in exchange, you can use Microsoft graph API too:

    • access the shared mailbox messages and folder.
    • Assign permissions.
    • Manage members or delegate access.

    Work around-Create shared mailbox via PowerShell

    you can use exchange online PowerShell with the following command

             New-Mailbox –Shared –Name “Support Team” –DisplayName “Support Mailbox” –Alias “support”
    

    Then assign users access to it:

             Add-MailboxPermission -Identity “support” -User “[******@contoso.com](mailto:******@contoso.com)” -AccessRights FullAccess -InheritanceType All
    
             Add-RecipientPermission -Identity “support” -Trustee “[******@contoso.com](mailto:******@contoso.com)”  -AccessRights SendAs
    

    Once created, the mailboxes accessible through Microsoft graph under the /users endpoint using its mailbox identity

    Accessing the shared mailbox via Microsoft graph

    you can read messages from a shared mailbox using the /users/{shared_mailbox}/messages endpoint.

    Example:

           GET [https://graph.microsoft.com/v1.0/users/******@contoso.com/messages](https://graph.microsoft.com/v1.0/users/******@contoso.com/messages)
    
           Authorization: Bearer <access_token>
    

    You will need to ensure your Azure AD application has appropriate delegated or application permissions:

    • Mail.Read
    • Mail.ReadWrite
    • Mail.Send

    See official graph permissions reference:

    Microsoft Graph permissions reference - Microsoft Graph | Microsoft Learn

    Shared mailboxes | Microsoft Learn

    Use the Outlook mail REST API - Microsoft Graph v1.0 | Microsoft Learn

    Install a Microsoft Graph SDK - Microsoft Graph | Microsoft Learn

    New-Mailbox (ExchangePowerShell) | Microsoft Learn

    If your goal is to automate shared mailbox creation, you can use Microsoft graph PowerShell SDK or exchange online management module in your automation pipeline instead of calling graph directly.

    Please let us know if you require any further assistance we’re happy to help. If you found this information useful, kindly mark this as "Accept Answer".


  2. h l 0 Reputation points
    2025-11-05T10:04:08.14+00:00

    Thank you for your reply. To avoid any misunderstanding between us regarding our respective interpretations, I would like to supplement with some screenshots.User's image

    I would like to add the type of shared email account shown in the screenshot.

    1 Regarding the PowerShell solution you mentioned, does your team provide any relevant SDKs or APIs for use?
    2 If we use the PowerShell solution, is it necessary to execute PowerShell commands on Microsoft's servers? (My understanding is that this is not feasible.) If it is not feasible, then how can I execute PowerShell commands on my own server to create a shared mailbox on a remote server?

    Thank you for your prompt reply and patient explanations.

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.