New PowerPoint JavaScript APIs are first introduced in "preview" and later become part of a specific, numbered requirement set after sufficient testing occurs and user feedback is acquired.
Note
Preview APIs are subject to change and are not intended for use in a production environment. We recommend that you try them out in test and development environments only. Do not 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.
API list
The following table lists the PowerPoint JavaScript APIs currently in preview. For a complete list of all PowerPoint JavaScript APIs (including preview APIs and previously released APIs), see all PowerPoint JavaScript APIs.
| Class | Fields | Description |
|---|---|---|
| AddSlideOptions | index | Specifies the 0-based index at which the new slide should be inserted. |
| Graphic | convertToShape() | |
| shape | Returns the Shape object associated with the graphic. |
|
| PictureAddOptions | height | Specifies the height, in points, of the picture. |
| left | Specifies the distance, in points, from the left side of the picture to the left side of the slide. | |
| top | Specifies the distance, in points, from the top edge of the picture to the top edge of the slide. | |
| width | Specifies the width, in points, of the picture. | |
| Presentation | getActiveSlideOrNullObject() | Returns the current active PowerPoint.Slide that is visible in the editing area. |
| onSlideSelectionChanged | Occurs when the selection of slides in the presentation changes. | |
| sensitivityLabel | Returns the sensitivity label of the presentation. | |
| RequestContext | sensitivityLabelsCatalog | |
| SensitivityLabel | getCurrentOrNullObject() | Gets the current label information that exists on the presentation for the user. |
| tryToUpdate(labelId: string) | Tries to update to the provided sensitivity label on the presentation for the user. | |
| SensitivityLabelDetails | children | Gets the sublabels of the sensitivity label. |
| color | Gets the color of the sensitivity label. | |
| id | Gets the unique ID of the sensitivity label. | |
| isEnabled | Gets a value indicating whether the label is enabled. | |
| name | Gets the name of the sensitivity label. | |
| order | Gets the priority of the sensitivity label, with 0 as lowest priority. | |
| protectionType | Gets a value indicating the protection type provided by this label. | |
| siteId | Gets the unique ID of the tenant which the sensitivity label is belonged. | |
| tooltip | Gets the description of the sensitivity label. | |
| SensitivityLabelDetailsCollection | getCount() | Gets the number of PowerPoint.SensitivityLabelDetails objects in this collection. |
| getItem(id: string) | Gets the specified SensitivityLabelDetails object in this collection. |
|
| getItemAt(index: number) | Gets the SensitivityLabelDetails object at the specified index in this collection. |
|
| getItemOrNullObject(id: string) | Gets the specified SensitivityLabelDetails object in this collection. |
|
| items | Gets the loaded child items in this collection. | |
| SensitivityLabelsCatalog | getLabelingCapability | Gets whether the catalog of sensitivity labels is enabled in PowerPoint. |
| getLabels() | Gets sensitivity labels that are available to the current user. | |
| Shape | getGraphicOrNullObject() | Returns a PowerPoint.Graphic object if this shape is a ShapeType.graphic. |
| ShapeCollection | addPicture(base64EncodedImage: string, options?: PowerPoint.PictureAddOptions) | Adds a picture to the slide. |
| SlideLayout | delete() | Deletes the slide layout from the presentation. |
| SlideMaster | delete() | Deletes the slide master and all child layouts from the presentation. |
| SlideSelectionChangedEventArgs | slideIds | Gets the array of IDs of the currently selected slides. |
See also
Office Add-ins