Training
Learning path
Use advance techniques in canvas apps to perform custom updates and optimization - Training
Use advance techniques in canvas apps to perform custom updates and optimization
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
This article describes how to implement shared folders (also known as delegate access) and shared mailbox scenarios in your Outlook add-in, including which permissions the Office JavaScript API supports.
Note
Shared folder support was introduced in requirement set 1.8, while shared mailbox support was introduced in requirement set 1.13. For information about client support for these features, see Supported clients and platforms.
The following table shows supported client-server combinations for this feature, including the minimum required Cumulative Update where applicable. Excluded combinations aren't supported.
Client | Exchange Online | Exchange 2019 on-premises (Cumulative Update 1 or later) |
Exchange 2016 on-premises (Cumulative Update 6 or later) |
---|---|---|---|
Web browser (modern Outlook UI) | Supported1 | Not applicable | Not applicable |
Web browser (classic Outlook UI) | Not applicable |
|
|
new Outlook on Windows | Supported | Not applicable | Not applicable |
Windows (classic) Shared folders: Version 1910 (Build 12130.20272) or later Shared mailboxes: Version 2304 (Build 16327.20248) or later |
Supported | Supported2 | Supported2 |
Mac Version 16.47 or later |
Supported | Supported | Supported |
Note
1In Outlook on the web, if you open a shared mailbox in a separate browser tab or window using the Open another mailbox option, you may encounter issues when accessing add-ins from the mailbox. We recommend opening the mailbox in the same panel as your primary mailbox instead. This ensures that add-ins work as expected in your shared mailbox. If you prefer to open the shared mailbox using the Open another mailbox option, we recommend deploying the add-in to both your primary user and shared mailboxes.
2Support for this feature in an on-premises Exchange environment is available starting in classic Outlook on Windows Version 2206 (Build 15330.20000) for the Current Channel and Version 2207 (Build 15427.20000) for the Monthly Enterprise Channel.
The following sections describe supported configurations for shared mailboxes and shared folders. The feature APIs may not work as expected in other configurations. Select the platform you'd like to learn how to configure.
The mailbox owner must first provide access to a delegate.
To provide access to manage meetings and meeting responses on behalf of the mailbox owner, see Calendar delegation in Outlook on the web.
To provide access to manage both the inbox and calendar on behalf of the mailbox owner, access must be configured through one of the following options.
The mailbox owner can configure access through classic Outlook on Windows. To learn more, see Allow someone else to manage your mail and calendar.
An administrator can configure access through the Microsoft 365 admin center. To learn more, see Give mailbox permissions to another Microsoft 365 user.
An administrator can configure access through the Exchange admin center. To learn more, see Manage permissions for recipients.
Once access is provided, the delegate must then follow the instructions outlined in Access another person's mailbox.
A shared mailbox allows a group of users to easily monitor and send messages and meeting invites using a shared email address.
In Outlook on the web, a shared mailbox can be opened in the same panel as a user's primary mailbox or in a separate browser tab or window. For guidance, see Open and use a shared mailbox in Outlook on the web.
Note
In Outlook on the web, if you open a shared mailbox in a separate browser tab or window using the Open another mailbox option, you may encounter issues when accessing add-ins from the mailbox. We recommend opening the mailbox in the same panel as your primary mailbox instead. This ensures that add-ins work as expected in your shared mailbox.
If you prefer to open the shared mailbox using the Open another mailbox option, we recommend deploying the add-in to both your primary user and shared mailboxes.
In new Outlook on Windows, a shared mailbox is added to the Shared with me section of the folder pane. For guidance, see Open and use a shared mailbox in Outlook.
To learn more about where add-ins do and don't activate in general, refer to the Mailbox items available to add-ins section of the Outlook add-ins overview page.
To implement shared folder and shared mailbox scenarios in your add-in, you must first configure support for the feature in your manifest. The markup varies depending on the type of manifest your add-in uses.
Note
Implementing shared folder and shared mailbox scenarios with a unified manifest for Microsoft 365 is currently only supported in classic Outlook on Windows. For other supported platforms, use the add-in only manifest instead.
Add an additional object to the "authorization.permissions.resourceSpecific" array and set its "name" property to "Mailbox.SharedFolder".
"authorization": {
"permissions": {
"resourceSpecific": [
...
{
"name": "Mailbox.SharedFolder",
"type": "Delegated"
},
]
}
},
Before you can run operations in a shared folder or shared mailbox, you must first identify whether the current folder or mailbox is shared. To determine this, call Office.context.mailbox.item.getSharedPropertiesAsync on a message or appointment in compose or read mode. If the item is in a shared folder or shared mailbox, the method returns a SharedProperties object that provides the user's permissions, the owner's email address, the REST API's base URL, and the location of the target mailbox.
The following example calls the getSharedPropertiesAsync
method to identify the owner of the mailbox and the permissions of the delegate or shared mailbox user.
Office.context.mailbox.item.getSharedPropertiesAsync((result) => {
if (result.status === Office.AsyncResultStatus.Failed) {
console.error("The current folder or mailbox isn't shared.");
return;
}
const sharedProperties = result.value;
console.log(`Owner: ${sharedProperties.owner}`);
console.log(`Permissions: ${sharedProperties.delegatePermissions} `);
});
The following table describes the permissions that getSharedPropertiesAsync
supports for delegates and shared mailbox users.
Permission | Value | Description |
---|---|---|
Read | 1 (000001) | Can read items. |
Write | 2 (000010) | Can create items. |
DeleteOwn | 4 (000100) | Can delete only the items they created. |
DeleteAll | 8 (001000) | Can delete any items. |
EditOwn | 16 (010000) | Can edit only the items they created. |
EditAll | 32 (100000) | Can edit any items. |
Note
Currently, the API supports getting existing permissions, but not setting permissions.
The DelegatePermissions enum returned by the delegatePermissions property is implemented using a bitmask to indicate the permissions. Each position in the bitmask represents a particular permission and if it's set to 1
, then the user has the respective permission. For example, if the second bit from the right is 1
, then the user has Write permission.
Once you've identified that the current mail item is in a shared folder or shared mailbox, your add-in can then perform the necessary operations on the item within the shared environment. To run operations on an item in a shared context, you must first configure your add-in's permission in the manifest. Then, use Microsoft Graph to complete the operations.
Note
Exchange Web Services (EWS) isn't supported in shared folder and shared mailbox scenarios.
To use Microsoft Graph services, an add-in must configure the read/write mailbox permission in its manifest. The markup varies depending on the type of manifest your add-in uses.
To implement your shared folder and shared mailbox scenarios, use Microsoft Graph to access additional mailbox information and resources. For example, you can use Microsoft Graph to get the contents of an Outlook message that's attached to a message in a mailbox where a user has delegate access. For guidance on how to use Microsoft Graph, see Overview of Microsoft Graph and Outlook mail API in Microsoft Graph.
Tip
To access Microsoft Graph APIs from your add-in, use MSAL.js nested app authentication (NAA). To learn more, see Enable SSO in an Office Add-in using nested app authentication (preview).
Depending on your add-in's scenarios, there are a few limitations for you to consider when handling shared folder or shared mailbox situations.
In Message Compose mode, getSharedPropertiesAsync isn't supported in Outlook on the web or on Windows (new and classic) unless the following conditions are met.
Delegate access/Shared folders
Shared mailbox
Once these conditions are met, the message becomes available in a shared context and add-ins that support these shared scenarios can get the item's shared properties. After the message is sent, it's usually found in the Sent Items folder of the sender's personal mailbox.
If an admin hid a user or shared mailbox address from an address list, such as the global address list (GAL), affected mail items opened in the mailbox report Office.context.mailbox.item
as null. For example, if the user opens a mail item in a shared mailbox that's hidden from the GAL, Office.context.mailbox.item
representing that mail item is null.
A delegate's updates to the owner's mailbox are usually synced across mailboxes immediately. However, if Microsoft Graph operations were used to set an extended property on an item, such changes could take some time to sync. To avoid a delay, we recommend you instead use the CustomProperties object and related APIs. To learn more, see the "Custom properties" tab of Get and set metadata in an Outlook add-in.
Office Add-ins feedback
Office Add-ins is an open source project. Select a link to provide feedback:
Training
Learning path
Use advance techniques in canvas apps to perform custom updates and optimization - Training
Use advance techniques in canvas apps to perform custom updates and optimization
Documentation
Automatically update your signature when switching between Exchange accounts - Office Add-ins
Learn how to automatically update your signature when switching between Exchange accounts through the OnMessageFromChanged and OnAppointmentFromChanged events in your event-based activation Outlook add-in.
On-send feature for Outlook add-ins - Office Add-ins
Provides a way to handle an item or block users from certain actions, and allows an add-in to set certain properties on send.
Get and set categories - Office Add-ins
How to manage categories on mailbox and item.