sp-dev-docs icon indicating copy to clipboard operation
sp-dev-docs copied to clipboard

Teams - Share app content to stage 501 error

Open pheidler opened this issue 8 months ago • 12 comments

Target SharePoint environment

SharePoint Online

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

💥 SharePoint Framework

Developer environment

Windows

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

  • [ ] 💥 Internet Explorer
  • [x] 💥 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
  • Node.js version 18.18.0

Describe the bug / error

I'm working on an in-meeting app for Teams and cannot share app content to the stage. The default share to stage functionality works (i.e share button in bottom of side panel), but a custom share button that invokes context.sdks.microsoftTeams.teamsJs.meeting.shareAppContentToStage() results in the following error:

{ "errorCode": 501, "message": "API is not supported in current context-Provided URL is invalid" }

The URL I am passing in is the tenant URL. I am following this example.

My manifest file has the following domains listed: ["{teamSiteDomain}", "<<domain-name>>", "${{TAB_DOMAIN}}"]. I've tried various combinations of other domains as well, including just using ["*"]. The error doesn't appear to be coming from a network request, so I'm guessing there's an issue with how the validDomains property is being checked (or possibly with the domains I've listed).

I have the following permissions listed:

"permissions": {
      "resourceSpecific": [
        {
          "name": "LiveShareSession.ReadWrite.Chat",
          "type": "Delegated"
        },
        {
          "name": "LiveShareSession.ReadWrite.Group",
          "type": "Delegated"
        },
        {
          "name": "MeetingStage.Write.Chat",
          "type": "Delegated"
        },
        {
          "name": "OnlineMeeting.ReadBasic.Chat",
          "type": "Application"
        },
        {
          "name": "ChannelMeeting.ReadBasic.Group",
          "type": "Application"
        }
      ]
    }

and the following contexts:

"context": [
        "channelTab",
        "privateChatTab",
        "meetingSidePanel",
        "meetingDetailsTab",
        "meetingChatTab",
        "meetingStage"
      ]

I wasn't sure if this is an SPFx issue or a TeamsJS issue. I've opened a ticket there as well. Thank you!

Steps to reproduce

  1. Create an SPFx Teams in meeting app
  2. Enable custom share to stage in the manifest.json file "supportsCustomShareToStage": true
  3. Invoke `shareAppContentToStage(() => {}, {tenantUrl})

Expected behavior

In meeting app opens for each user in the stage context.

pheidler avatar May 07 '25 18:05 pheidler

Hello @pheidler Thank you for bringing this issue to our attention. We will look into it and get back to you shortly.

Ashlesha-MSFT avatar May 08 '25 04:05 Ashlesha-MSFT

@pheidler, Can you please help me by sharing the code to reproduce the issue, because even if I added

"context": [
          "meetingSidePanel",
          "meetingStage"
          
        ]

getting below error Error: This call is only allowed in following contexts: ["sidePanel","meetingStage"]. Current context: "content".

Image

Ashlesha-MSFT avatar May 08 '25 19:05 Ashlesha-MSFT

@Ashlesha-MSFT It looks like you have the app open in the wrong context- if you join the meeting, you can open the app in the side panel. Let me know if that works. If not, I can work on a reproducible example.

Just another bit of context- I'm adding the app programmatically to the chat from a Teams tab app using the following:

const teamsApp = await client
          .api(`/appCatalogs/teamsApps?$filter=externalId eq '${externalId}'`)
          .get();
        const teamsAppId = teamsApp.value[0].id;

        // Adds app to the meeting
        await client.api(`/chats/${threadId}/installedApps`).post({
          "[email protected]": `https://graph.microsoft.com/v1.0/appCatalogs/teamsApps/${teamsAppId}`,
          consentedPermissionSet: {
            resourceSpecificPermissions: [
              {
                permissionValue: "OnlineMeeting.ReadBasic.Chat",
                permissionType: "Application",
              },
              {
                permissionValue: "ChannelMeeting.ReadBasic.Group",
                permissionType: "Application",
              },
              {
                permissionValue: "LiveShareSession.ReadWrite.Chat",
                permissionType: "Delegated",
              },
              {
                permissionValue: "LiveShareSession.ReadWrite.Group",
                permissionType: "Delegated",
              },
              {
                permissionValue: "MeetingStage.Write.Chat",
                permissionType: "Delegated",
              },
            ],
          },
        });

        // Adds tab to the meeting
        await client.api(`/chats/${threadId}/tabs`).post({
          displayName: appName,
          "[email protected]": `https://graph.microsoft.com/v1.0/appCatalogs/teamsApps/${teamsAppId}`,
          configuration: {
            entityId: extension,
            contentUrl: tabContentUrl,
            websiteUrl: websiteUrl,
            removeUrl: null,
          },
        });

pheidler avatar May 08 '25 20:05 pheidler

@pheidler, Thanks for suggestion! We were able to reproduce the issue, and we are investigating it. We have logged this as a bug, and our engineering team will look into it. Thank you for your patience! Image

Ashlesha-MSFT avatar May 09 '25 07:05 Ashlesha-MSFT

@Ashlesha-MSFT Great, thank you!

pheidler avatar May 09 '25 14:05 pheidler

@Ashlesha-MSFT Any idea what the timeline is for this fix?

pheidler avatar May 19 '25 22:05 pheidler

@Amey-MSFT @Ashlesha-MSFT Any update on this?

pheidler avatar Jul 24 '25 22:07 pheidler

@pheidler, At this moment, there are no updates from the engineering team regarding the fix for the shareAppContentToStage 501 error.

Ashlesha-MSFT avatar Jul 25 '25 08:07 Ashlesha-MSFT

@pheidler, This issue appears to be resolved on our end.

If everything looks good, shall we go ahead and close the issue?

Image

Ashlesha-MSFT avatar Aug 13 '25 08:08 Ashlesha-MSFT

@Ashlesha-MSFT I'm no longer seeing the error, but the "Share" button at the bottom is not going away as expected, and the custom share button is not sharing the app to the main stage.

pheidler avatar Aug 13 '25 20:08 pheidler

@Ashlesha-MSFT Can you please confirm this behavior? The problem is not resolved.

pheidler avatar Aug 15 '25 21:08 pheidler

Hi @pheidler, Thanks for the follow-up.

I've reached out to the engineering team regarding this issue and will keep you updated as soon as I hear back from them.

Ashlesha-MSFT avatar Aug 18 '25 05:08 Ashlesha-MSFT