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:
- Get-MgUser | Select-Object UserPrincipalName, @{Name='MailboxType'; Expression={(Get-MgUserMailboxSetting -UserId $.UserPrincipalName).UserPurpose}} | Where-Object {$.MailboxType -eq 'shared'}
- 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.