Skip to content

SPFX ACE - running on Viva Connection Dashboard on Teams app (WebView or Teams APP MAC) the sdk property object of context (AdaptiveCardExtensionContext) is undefined #10291

Open
@joaojmendes

Description

@joaojmendes

Target SharePoint environment

SharePoint Online

What SharePoint development model, framework, SDK or API is this about?

💥 SharePoint Framework

Developer environment

macOS

What browser(s) / client(s) have you tested

  • 💥 Internet Explorer
  • 💥 Microsoft Edge
  • 💥 Google Chrome
  • 💥 FireFox
  • 💥 Safari
  • mobile (iOS/iPadOS)
  • mobile (Android)
  • not applicable
  • other (enter in the "Additional environment details" area below)

Additional environment details

  • SPFx version. 1.21.1
  • Node.js version v22.14.0

Describe the bug / error

SPFX ACE - running on Viva Connection Dashboard on Teams (WebView or Teams APP MAC), the sdks property object of context (AdaptiveCardExtensionContext) is undefined.

I'm trying to get the current theme applied to the Teams to use on my Controls. Please take a look at my code.

  const hasTeamsContext = context.sdks?.microsoftTeams?.teamsJs !== undefined;
   console.log('context', context);
  if (hasTeamsContext) {
    // get teams theme
    const teamsContext =
      await context?.sdks?.microsoftTeams?.teamsJs?.app?.getContext();
    console.log('teamsContext', teamsContext);
    // If the context is available, determine the theme based on the app info
    if (teamsContext) {
     console.log('teamsContext.app', teamsContext.app);
      const teamsTheme = teamsContext.app?.appInfo.theme || "default";
      switch (teamsTheme) {
        case "dark":
          return teamsDarkTheme;
        case "contrast":
          return teamsHighContrastTheme;
        case "default":
          return teamsLightTheme;
        default:
          return teamsLightTheme; // Fallback to light theme
      }
    }
  }

the ...context.sdks is undefined.

here the printScreen of context on the console log.

Image Image

On team's mobile app works fine.
Image
Image
Image

Steps to reproduce

You need to have an ACE that uses HTML QuickView or React Control that uses FluentUI 9 Theme and try to get the theme from the ACE Context to use on the controls.

Expected behavior

The sdks object on the context filled

Metadata

Metadata

Assignees

Labels

area:spfx-msteamsCategory: SharePoint Framework & Microsoft Teams supportsharepoint-developer-supportsharepoint-developer-supporttype:bug-suspectedSuspected bug (not working as designed/expected). See “type:bug-confirmed” for confirmed bugs.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions