How to find the list of shared mailboxes using Graph API call?

Kesava Chenna 20 Reputation points
2025-01-31T07:41:52.8566667+00:00

Please write an API call to find the list of all shared and group mailboxes present in the organisation

Microsoft Security | Microsoft Graph
0 comments No comments
{count} votes

Accepted answer
  1. Rajat Vashistha-MSFT 1,690 Reputation points Microsoft External Staff
    2025-01-31T08:35:07.3733333+00:00

    Hi Kesava Chenna,

    Thank you for reaching out to Microsoft!

    Currently, there is no Microsoft Graph API available to which directly list all the shared mailboxes. You can upvote this features request idea Get a list of shared mailboxes and based on number of votes received Microsoft Engineering will consider for implementation.

    Eventually, you can use the GET /users/{id|userPrincipalName}/mailboxSettings endpoint, which in its response has the "userPurpose" value to determine if the account is a shared mailbox or user mailbox. This method is helpful if you already have the UPN.

    Alternatively, you can use Graph PowerShell or Exchange PowerShell to find shared mailboxes:

    1. Get-MgUser | Select-Object UserPrincipalName, @{Name='MailboxType'; Expression={(Get-MgUserMailboxSetting -UserId $.UserPrincipalName).UserPurpose}} | Where-Object {$.MailboxType -eq 'shared'}
    2. Get-Mailbox -RecipientTypeDetails SharedMailbox -ResultSize:Unlimited

    For fetching group mailboxes, you can use the following endpoint: List Groups

    GET https://graph.microsoft.com/v1.0/groups

    Hope this helps.

    If the answer is helpful, please click Accept Answer and kindly upvote it. If you have any further questions about this answer, please click Comment.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

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