Skip to content

Accessing themeColorScheme leads to error in PowerPoint Online #6582

@PaulBol

Description

@PaulBol

Your Environment

  • Platform [PC desktop, Mac, iOS, Office on the web]: Office on the web
  • Host [Excel, Word, PowerPoint, etc.]: PowerPoint
  • Office version number: latest
  • Operating System: browser-based (Windows)
  • Browser (if using Office on the web): Edge, Firefox

Expected behavior

I expect the following code to print the color code of the Accent 1 color, e.g., Accent1: #156082.

PowerPoint.run(async context => {
    if (Office.context.requirements.isSetSupported("PowerPointApi", "1.10")) {
        const masters = context.presentation.slideMasters;
        masters.load("items");
        await context.sync();

        const scheme = masters.items[0].themeColorScheme;
        await context.sync(); // <-- Error occurs here (or in second context.sync if commented out)

        const color = scheme.getThemeColor("Accent1");
        await context.sync();

        console.log(`Accent1: ${color.value}`);
    }
});

Current behavior

The code works as expected on PowerPoint on Windows.

In PowerPoint Online the context.sync() fails with: Uncaught (in promise) RichApi.Error: GeneralException

Steps to reproduce

  1. Open Script Lab add-in > New
  2. Paste code above and run
  3. See output in add-in on Windows and error in browser console in PowerPoint Online

Link to live example(s)

n/a

Context

I want to determine if a textbox shape uses a theme color for the font. PowerPoint.ShapeFont.color only returns a hex color code, so I need to compare it with the theme colors.

Useful logs

n/a

Metadata

Metadata

Assignees

Labels

Area: PowerPointIssue related to PowerPoint add-insNeeds: attention 👋Waiting on Microsoft to provide feedbackPlatform: OnlineIssues occurred on online platformType: product bugBug in the Office Add-ins platform or Office JavaScript APIs

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions