Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
The Outlook add-in API subset of the Office JavaScript API includes objects, methods, properties, and events that you can use in an Outlook add-in.
Preview APIs are subject to change and aren't intended for use in a production environment. We recommend that you try them out in test and development environments only. Don't use preview APIs in a production environment or within business-critical documents.
To use preview APIs:
You must use the preview version of the Office JavaScript API library from the Office.js content delivery network (CDN). The type definition file for TypeScript compilation and IntelliSense is found at the CDN and DefinitelyTyped. You can install these types with
npm install --save-dev @types/office-js-preview(be sure to remove the types for@types/office-jsif you've previously installed them).You may need to join the Microsoft 365 Insider program for access to more recent Office builds in Outlook on Windows and on Mac.
You may need to configure the Targeted release option on your Microsoft 365 tenant to preview features in Outlook on the web. For more information, see the "Targeted release" section of Set up the Standard or Targeted release options.
The preview requirement set includes all of the features of requirement set 1.15.
Important
This documentation is for a preview requirement set. This requirement set isn't fully implemented yet, and clients won't accurately report support for it. You shouldn't specify this requirement set in your add-in manifest.
Features in preview
The following features are in preview.
- Added an event and objects to support decrypting a message and its attachments.
- Extended support for the
contentIdproperty to get the content identifier of an inline attachment in classic Outlook on Windows. - Added a method to check if Exchange Web Services (EWS) tokens are supported in an organization.
- Updated the Recipients APIs to increase the maximum number of recipients in a target field to 1,000.
- Increased the SessionData object limit to 2,621,440 characters.
- Extended support for the
errorMessageMarkdownproperty of theevent.completedmethod to Smart Alerts add-ins in Outlook on Mac. - Added a property to get or set whether an appointment is an all-day event.
- Added events to activate an event-based add-in on a message in read mode when it contains certain attachment types or custom internet headers.
- Added a property and objects to temporarily set the body or subject displayed in read mode.
API list
The following table lists the Outlook JavaScript APIs currently in preview. To view API reference documentation for all Outlook JavaScript APIs (including preview APIs and previously released APIs), see Outlook APIs.
| Class | Fields | Description |
|---|---|---|
| AppointmentCompose | isAllDayEvent | Gets or sets the Office.IsAllDayEvent property of an appointment. |
| AppointmentRead | isAllDayEvent | Returns a boolean value indicating whether the event is all day. |
| DecryptedMessageAttachment | attachmentType | Specifies the type of attachment. |
| content | Specifies the Base64-encoded content of the attachment. | |
| contentId | Specifies the content identifier of an inline attachment. | |
| isInline | If true, specifies that the decrypted attachment appears as an image in the body of the message instead of in the attachment list. | |
| name | Specifies the name of the attachment. | |
| path | Specifies the URL reference path of the attachment if its type is MailboxEnums.AttachmentType.Cloud. |
|
| DecryptedMessageBody | coercionType | Specifies the format of the body of a message. |
| content | Specifies the content displayed in the body of the message. | |
| Diagnostics | ews | Gets an object to identify whether Exchange Web Services (EWS) callback tokens are supported in an organization. |
| Display | body | Gets an object to temporarily set the content displayed in the body of a message in read mode. |
| subject | Gets an object to temporarily set the content displayed in the subject of a message in read mode. | |
| DisplayedBody | setAsync(data: string, callback?: (asyncResult: Office.AsyncResult<void>) => void) | Temporarily sets the content displayed in the body of a message in read mode. |
| setAsync(data: string, options: Office.AsyncContextOptions & CoercionTypeOptions, callback?: (asyncResult: Office.AsyncResult<void>) => void) | Temporarily sets the content displayed in the body of a message in read mode. | |
| DisplayedSubject | setAsync(data: string, callback?: (asyncResult: Office.AsyncResult<void>) => void) | Temporarily sets the content displayed in the subject of a message in read mode. |
| setAsync(data: string, options: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult<void>) => void) | Temporarily sets the content displayed in the subject of a message in read mode. | |
| Ews | getTokenStatusAsync(callback: (asyncResult: Office.AsyncResult<MailboxEnums.TokenStatus>) => void) | Gets the status of EWS callback tokens in an organization. |
| getTokenStatusAsync(options: Office.AsyncContextOptions & { isRest?: boolean }, callback: (asyncResult: Office.AsyncResult<MailboxEnums.TokenStatus>) => void) | Gets the status of EWS callback tokens in an organization. | |
| IsAllDayEvent | getAsync(callback: (asyncResult: Office.AsyncResult<boolean>) => void) | Gets the boolean value indicating whether the event is all day or not. |
| getAsync(options: Office.AsyncContextOptions, callback: (asyncResult: Office.AsyncResult<boolean>) => void) | Gets the boolean value indicating whether the event is all day or not. | |
| setAsync(isAllDayEvent: boolean, callback?: (asyncResult: Office.AsyncResult<void>) => void) | Sets the all-day event status of an appointment. | |
| setAsync(isAllDayEvent: boolean, options: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult<void>) => void) | Sets the all-day event status of an appointment. | |
| MailboxEvent | completed(options?: SmartAlertsEventCompletedOptions | SpamReportingEventCompletedOptions | MessageDecryptEventCompletedOptions) | Indicates that the event-based, spam-reporting, or decryption (preview) add-in has completed processing an event. |
| MessageDecryptEventCompletedOptions | allowEvent | When you use the completed method to signal completion of an event handler, |
| attachments | When you use the completed method to signal completion of an event handler | |
| contextData | When you use the completed method to signal completion of an event handler | |
| emailBody | When you use the completed method to signal completion of an event handler | |
| MessageRead | display | Gets an object to temporarily set the content displayed in the body or subject of a message in read mode. |
| TokenStatus | Disabled | EWS callback tokens or REST API tokens are turned off in the organization. |
| Enabled | EWS callback tokens or REST API tokens are supported in the organization. | |
| Removed | The mailbox is hosted in an Exchange Online environment where EWS tokens are turned off and are no longer supported. |
See also
Office Add-ins