Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Outlook] Publish Mailbox 1.15 #4962

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .openpublishing.publish.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"outlook-js-1.12",
"outlook-js-1.13",
"outlook-js-1.14",
"outlook-js-1.15",
"powerpoint-js-preview",
"powerpoint-js-1.1",
"powerpoint-js-1.2",
Expand Down
2 changes: 1 addition & 1 deletion .openpublishing.redirection.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
},
{
"source_path": "docs/reference/outlook-api-reference-latest.md",
"redirect_url": "/javascript/api/outlook?view=outlook-js-1.14"
"redirect_url": "/javascript/api/outlook?view=outlook-js-1.15"
},
{
"source_path": "docs/reference/powerpoint-api-reference.md",
Expand Down
26 changes: 7 additions & 19 deletions docs/outlook/item-multi-select.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Activate your Outlook add-in on multiple messages
description: Learn how to activate your Outlook add-in when multiple messages are selected.
ms.date: 11/14/2024
ms.date: 01/09/2025
ms.topic: how-to
ms.localizationpriority: medium
---
Expand Down Expand Up @@ -44,7 +44,7 @@ Complete the [Outlook quick start](../quickstarts/outlook-quickstart-yo.md) to c

1. In first object of the "extensions.runtimes" array, make the following changes.

1. Change the "requirements.capabilities.minVersion" property to "1.13".
1. Change the "requirements.capabilities.minVersion" property to "1.15". Although the item multi-select feature was introduced in requirement set 1.13, this sample uses enhancements from later requirement sets.
1. In the same "actions" object, add the "supportsNoItemContext" property and set it to `true`.
1. In the same "actions" object, add the "multiselect" property and set it to `true`.

Expand All @@ -57,7 +57,7 @@ Complete the [Outlook quick start](../quickstarts/outlook-quickstart-yo.md) to c
"capabilities": [
{
"name": "Mailbox",
"minVersion": "1.13"
"minVersion": "1.15"
}
]
},
Expand Down Expand Up @@ -108,7 +108,7 @@ To enable your add-in to activate on multiple selected messages, you must add th
<VersionOverrides xmlns="http://schemas.microsoft.com/office/mailappversionoverrides" xsi:type="VersionOverridesV1_0">
<VersionOverrides xmlns="http://schemas.microsoft.com/office/mailappversionoverrides/1.1" xsi:type="VersionOverridesV1_1">
<Requirements>
<bt:Sets DefaultMinVersion="1.13">
<bt:Sets DefaultMinVersion="1.15">
<bt:Set Name="Mailbox"/>
</bt:Sets>
</Requirements>
Expand Down Expand Up @@ -191,15 +191,6 @@ Item multi-select relies on the [SelectedItemsChanged](/javascript/api/office/of
</main>
```

1. For classic Outlook on Windows only. Replace the existing **script** element with the following markup. This references the preview version of the Office JavaScript API.

```html
<script type="text/javascript" src="https://appsforoffice.microsoft.com/lib/beta/hosted/office.js"></script>
```

> [!NOTE]
> The preview version of the Office JavaScript API is used because this walkthrough implements the `loadItemByIdAsync` and `unloadAsync` methods, which are currently in preview. If your multi-select add-in doesn't implement these methods, use `https://appsforoffice.microsoft.com/lib/1.1/hosted/office.js` instead. For more information, see [Referencing the Office JavaScript API library](../develop/referencing-the-javascript-api-for-office-library-from-its-cdn.md).

1. Save your changes.

## Implement a handler for the SelectedItemsChanged event
Expand Down Expand Up @@ -247,16 +238,14 @@ Now that you've registered an event handler, your add-in can now get properties
- Item mode (`Read` or `Compose`)
- Item type (`Message` is the only supported type at this time)
- Subject line
- Call the [loadItemByIdAsync](/javascript/api/outlook/office.mailbox?view=outlook-js-preview&preserve-view=true#outlook-office-mailbox-loaditembyidasync-member(1)) method (preview) to get properties that aren't provided by `getSelectedItemsAsync` or to run operations on the selected messages. The `loadItemByIdAsync` method loads one selected message at a time using the message's Exchange Web Services (EWS) ID. To get the EWS IDs of the selected messages, we recommend calling `getSelectedItemsAsync`. After processing a selected message using `loadItemByIdAsync`, you must call the [unloadAsync](/javascript/api/outlook/office.loadedmessageread?view=outlook-js-preview&preserve-view=true#outlook-office-loadedmessageread-unloadasync-member(1)) method (preview) before calling `loadItemByIdAsync` on another selected message.
- Call the [loadItemByIdAsync](/javascript/api/outlook/office.mailbox?view=outlook-js-1.15&preserve-view=true#outlook-office-mailbox-loaditembyidasync-member(1)) method to get properties that aren't provided by `getSelectedItemsAsync` or to run operations on the selected messages. The `loadItemByIdAsync` method loads one selected message at a time using the message's Exchange Web Services (EWS) ID. To get the EWS IDs of the selected messages, we recommend calling `getSelectedItemsAsync`. After processing a selected message using `loadItemByIdAsync`, you must call the [unloadAsync](/javascript/api/outlook/office.loadedmessageread?view=outlook-js-1.15&preserve-view=true#outlook-office-loadedmessageread-unloadasync-member(1)) method before calling `loadItemByIdAsync` on another selected message.

> [!TIP]
> Before you use the `loadItemByIdAsync` method, determine if you can already access the properties you need using `getSelectedItemsAsync`. If you can, you don't need to call `loadItemByIdAsync`.
> - The `loadItemByIdAsync` and `unloadAsync` methods were introduced in [requirement set 1.15](/javascript/api/requirement-sets/outlook/requirement-set-1.15/outlook-requirement-set-1.15). Learn more about its [supported clients and platforms](/javascript/api/requirement-sets/outlook/outlook-api-requirement-sets#outlook-client-support).
> - Before you use the `loadItemByIdAsync` method, determine if you can already access the properties you need using `getSelectedItemsAsync`. If you can, you don't need to call `loadItemByIdAsync`.

The following example implements the `getSelectedItemsAsync` and `loadItemByIdAsync` methods to get the subject line and sender's email address from each selected message.

> [!NOTE]
> The `loadItemByIdAsync` method is currently in preview in classic Outlook on Windows. To preview this API, install Version 2405 (Build 17606.10000) or later. Then, join the [Microsoft 365 Insider program](https://insider.microsoft365.com/join/Windows) and select the **Beta Channel** option.

1. In **taskpane.js**, replace the existing `run` function with the following code.

```javascript
Expand All @@ -280,7 +269,6 @@ The following example implements the `getSelectedItemsAsync` and `loadItemByIdAs
async function getItemInfo(selectedItems) {
for (const item of selectedItems) {
addToList(item.subject);
// The loadItemByIdAsync method is currently only available to preview in classic Outlook on Windows.
if (Office.context.diagnostics.platform === Office.PlatformType.PC) {
await getSenderEmailAddress(item);
}
Expand Down
11 changes: 6 additions & 5 deletions docs/outlook/onmessagesend-onappointmentsend-events.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Handle OnMessageSend and OnAppointmentSend events in your Outlook add-in with Smart Alerts
description: Learn about the Smart Alerts implementation and how it handles the OnMessageSend and OnAppointmentSend events in your event-based Outlook add-in.
ms.date: 12/19/2024
ms.date: 01/09/2025
ms.topic: concept-article
ms.localizationpriority: medium
---
Expand All @@ -28,6 +28,9 @@ The following table lists supported client-server combinations for the Smart Ale
|**Android**|Not applicable|Not applicable|Not applicable|
|**iOS**|Not applicable|Not applicable|Not applicable|

> [!IMPORTANT]
> Enhancements to the Smart Alerts feature were introduced in later requirement sets. Because of this, the minimum supported Outlook version and build may vary. The requirement sets and versions needed for a feature are mentioned in the [walkthrough](smart-alerts-onmessagesend-walkthrough.md) and applicable sections of this article.

## Try out Smart Alerts in an event-based add-in

To see Smart Alerts in action, try out the [walkthrough](smart-alerts-onmessagesend-walkthrough.md). You'll create an add-in that checks whether a document or picture is attached to a message before it's sent.
Expand Down Expand Up @@ -242,11 +245,9 @@ In Outlook on the web and in new Outlook on Windows:
### Limitations to formatting the dialog message using Markdown

> [!NOTE]
> Support for Markdown in a Smart Alerts dialog is currently in preview in Outlook on the web and on Windows (new and classic). Features in preview shouldn't be used in production add-ins. We invite you to try out this feature in test or development environments and welcome feedback on your experience through GitHub (see the Feedback section at the end of this page).
>
> To test this feature in classic Outlook on Windows, you must install Version 2403 (Build 17330.10000) or later. Then, join the [Microsoft 365 Insider program](https://insider.microsoft365.com/join/windows) and select the **Beta Channel** option in your Outlook client to access Office beta builds.
> Support for Markdown in a Smart Alerts dialog was introduced in [requirement set 1.15](/javascript/api/requirement-sets/outlook/requirement-set-1.15/outlook-requirement-set-1.15). Learn more about its [supported clients and platforms](/javascript/api/requirement-sets/outlook/outlook-api-requirement-sets#outlook-client-support).

You can use Markdown to format the message of a Smart Alerts dialog. However, only the following elements are supported.
You can use Markdown to format the message of a Smart Alerts dialog through the `errorMessageMarkdown` option of the `event.completed` call. However, only the following elements are supported.

- Bold, italic, or bold and italic text. Both the [asterisk (*) and underscore (_) formats](https://www.markdownguide.org/basic-syntax/#emphasis) are supported.

Expand Down
14 changes: 5 additions & 9 deletions docs/outlook/smart-alerts-onmessagesend-walkthrough.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Automatically check for an attachment before a message is sent
description: Learn how to implement an event-based add-in that implements Smart Alerts to automatically check a message for an attachment before it's sent.
ms.date: 10/08/2024
ms.date: 01/09/2025
ms.topic: how-to
ms.localizationpriority: medium
---
Expand Down Expand Up @@ -31,7 +31,7 @@ To configure the manifest, select the tab for the type of manifest you are using

1. Add the following object to the "extensions.runtimes" array. Note the following about this markup:

- The "minVersion" of the Mailbox requirement set is set to "1.12" because the [supported events table](autolaunch.md#supported-events) specifies that this is the lowest version of the requirement set that supports the `OnMessageSend` event.
- Although the `OnMessageSend` event was introduced in requirement set 1.12, the "minVersion" is set to "1.15". This supports the use of Smart Alerts enhancements that were introduced in later requirement sets.
- The "id" of the runtime is set to the descriptive name "autorun_runtime".
- The "code" property has a child "page" property that is set to an HTML file and a child "script" property that is set to a JavaScript file. You'll create or edit these files in later steps. Office uses one of these values or the other depending on the platform.
- Classic Outlook on Windows executes the event handler in a JavaScript-only runtime, which loads a JavaScript file directly.
Expand Down Expand Up @@ -86,7 +86,7 @@ To configure the manifest, select the tab for the type of manifest you are using
"capabilities": [
{
"name": "Mailbox",
"minVersion": "1.12"
"minVersion": "1.15"
}
],
"scopes": [
Expand Down Expand Up @@ -117,7 +117,7 @@ To configure the manifest, select the tab for the type of manifest you are using
<VersionOverrides xmlns="http://schemas.microsoft.com/office/mailappversionoverrides" xsi:type="VersionOverridesV1_0">
<VersionOverrides xmlns="http://schemas.microsoft.com/office/mailappversionoverrides/1.1" xsi:type="VersionOverridesV1_1">
<Requirements>
<bt:Sets DefaultMinVersion="1.12">
<bt:Sets DefaultMinVersion="1.15">
<bt:Set Name="Mailbox" />
</bt:Sets>
</Requirements>
Expand Down Expand Up @@ -225,11 +225,6 @@ You have to implement handling for your selected event.

In this scenario, you'll add handling for sending a message. Your add-in will check for certain keywords in the message. If any of those keywords are found, it will then check for any attachments. If there are no attachments, your add-in will recommend to the user to add the possibly missing attachment.

> [!NOTE]
> The event handler in this walkthrough implements the [errorMessageMarkdown](/javascript/api/outlook/office.smartalertseventcompletedoptions?view=outlook-js-preview&preserve-view=true#outlook-office-smartalertseventcompletedoptions-errormessagemarkdown-member) property. This property is currently in preview in Outlook on the web and on Windows (new and classic). Features in preview shouldn't be used in production add-ins. We invite you to try out this feature in test or development environments and welcome feedback on your experience through GitHub (see the Feedback section at the end of this page).
>
> To test this feature in classic Outlook on Windows, you must install Version 2403 (Build 17330.10000) or later. Then, join the [Microsoft 365 Insider program](https://insider.microsoft365.com/join/windows) and select the **Beta Channel** option in your Outlook client to access Office beta builds.

1. From the same quick start project, create a new folder named **launchevent** under the **./src** directory.

1. In the **./src/launchevent** folder, create a new file named **launchevent.js**.
Expand Down Expand Up @@ -327,6 +322,7 @@ In this scenario, you'll add handling for sending a message. Your add-in will ch
>
> - In classic Outlook on Windows, imports aren't currently supported in the JavaScript file where you implement the handling for event-based activation.
> - To ensure your add-in runs as expected when an `OnMessageSend` or `OnAppointmentSend` event occurs, call `Office.actions.associate` in the JavaScript file where your handlers are implemented. This maps the event handler name specified in the manifest to its JavaScript counterpart. If this call isn't included in your JavaScript file and the send mode property of your manifest is set to **soft block** or isn't specified, your users will be blocked from sending messages or meetings.
> - The [errorMessageMarkdown](/javascript/api/outlook/office.smartalertseventcompletedoptions#outlook-office-smartalertseventcompletedoptions-errormessagemarkdown-member) property was introduced in [requirement set 1.15](/javascript/api/requirement-sets/outlook/requirement-set-1.15/outlook-requirement-set-1.15). Learn more about its [supported clients and platforms](/javascript/api/requirement-sets/outlook/outlook-api-requirement-sets#outlook-client-support).

## Customize the Don't Send button (optional)

Expand Down