Forum Discussion
Tim_Walker513
Jan 21, 2023Copper Contributor
Issue with shareAppContentToStage
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 ...
Tim_Walker513
Jan 22, 2023Copper Contributor
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?
Nivedipa-MSFT
Microsoft
Jan 23, 2023Tim_Walker513 - Thanks for reporting your issue.
Could you please share which sample you are referring to? Any repro steps would be really helpful.
Could you please share which sample you are referring to? Any repro steps would be really helpful.
- Tim_Walker513Jan 23, 2023Copper ContributorSo 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.
- Nivedipa-MSFTJan 24, 2023
Microsoft
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.
JavaScript
app.getContext().then((context: Context) => { var appContentUrl = "https://www.demo.com/device?launchedBy="+context.loginHint; microsoftTeams.meeting.shareAppContentToStage((err, result) => { if (result) { // handle success } if (err) { // handle error } }, appContentUrl); });
Thanks,
Nivedipa
*************************************************************************
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.