Can you differentiate between shared mailbox and delegate mailbox using OfficeJS API or Microsoft Graph API?

Diksha Yadav 81 Reputation points
2023-11-24T09:28:41.3733333+00:00

Is it possible to distinguish between shared mailbox or delegate mailbox using OfficeJS API or Microsoft Graph API?

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
13,050 questions
JavaScript API
JavaScript API
An Office service that supports add-ins to interact with objects in Office client applications.
1,043 questions
0 comments No comments
{count} votes

Accepted answer
  1. Macháček Martin 286 Reputation points
    2024-02-01T06:52:44.5233333+00:00

    User resource has property mailboxSettings with inner property userPurpose. It differentiates a mailbox for a single user from a shared mailbox and equipment mailbox in Exchange Online. Possible values are:

    user A user account with a mailbox in the local forest.
    linked A mailbox linked to a user account in another forest.
    shared A mailbox shared by two or more user accounts.
    room A mailbox that represents a conference room.
    equipment A mailbox that represents a piece of equipment.
    others A mailbox was found but the user purpose is different from the ones specified in the previous scenarios.

    Limitation is that you need application permission MailboxSettings.Read to be able to read the property mailboxSettings for other users GET /users/{id|userPrincipalName}/mailboxSettings With delegated permission MailboxSettings.Read you can read mailboxSettings only for signed-in user.

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Md Asif Muztaba 320 Reputation points Microsoft Vendor
    2024-02-01T04:25:08.5566667+00:00

    Yes, it is possible to distinguish between a shared mailbox and a delegate mailbox using the Microsoft Graph API. For shared mailboxes, you can use the Mail.Read.Shared or Mail.ReadWrite.Shared permissions. These permissions only work for delegated permissions. You can access the shared mailbox and its messages like the following: GET https://graph.microsoft.com/v1.0/users/{sharedmailboxmailaddress}/messages For delegated mailboxes, Microsoft Graph supports getting messages in mail folders that have been shared by other users, and getting the shared folders themselves. For example, if a user has shared and given read access to their Inbox to another user, your app can access the sharer's mail and Inbox as described in this article. However, it seems there is no direct way to differentiate shared mailboxes and normal user mailboxes with Microsoft Graph API explorer. You could assign a keyword (like 'shared') as the givenName when creating shared mailboxes, or using the beta "findroomlists" outlook api endpoint. As for the OfficeJS API, there doesn't seem to be a straightforward way to distinguish between a shared mailbox and a delegate mailbox based on the search results. Please ACCEPT the answer if it helps you. Otherwise you can make comments on it.

    0 comments No comments

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.