Issue with shareAppContentToStage

Copper Contributor

I'm using Microsoft Visual Studio 2022 and the Teams SDK (C#). I have a working application, but am trying to use the shareAppContentToStage JS function. I am able to confirm with logging statements that microsoftTeams and microsoftTeams.meeting are both available, and I see some of the functions off of these as well. For some reason shareAppContentToStage is not availble and shows up as undefined. Any ideas on what could cause this? I had it work late last night, but seems like something has changed (hoping it's just on my end). Any help would be greatly appreciated!

4 Replies

Quick update - I am able to now call it, but only after I remove the teamsUserCredential.GetUserInfoAsync() call first. Not sure what that has to do with it, but definitely was extremely hard to pinpoint as there is no error messages that tell you that. Any ideas on what caused this or how I can get the user email with that call or another call?

@Tim_Walker513 - Thanks for reporting your issue.
Could you please share which sample you are referring to? Any repro steps would be really helpful.
So no sample - this is an app I wrote for myself. Simple app that has a static tab and a configurable tab that launches in to a side panel app. That app then has a button that is supposed to launch the center stage. I was able to figure it out (not easy, as this is not documented any where that I can find), but still having issues if I call GetUserInfoAsync() - that call appears to remove the shareAppContentToStage from the microsoftTeams.meeting javascript object.

@Tim_Walker513 -

When you click on launch a device you can fetch the current user who is launching the stage view by calling app.getContext() and accessing loginHint property.
Doc ref: Get context by using the Microsoft Teams JavaScript library
You can pass this as query string parameter as part of app content URL.
// Note: Please use the code from doc reference.


app.getContext().then((context: Context) => {
    var appContentUrl = ""+context.loginHint;
        microsoftTeams.meeting.shareAppContentToStage((err, result) => {
            if (result) {
                // handle success            }
            if (err) {
                // handle error            }
        }, appContentUrl);

If the response is helpful, please click "Mark as Best Response" and like it. You can share your feedback via Microsoft Teams Developer Feedback link. Click here to escalate.