VS 2022 Teams App: in startup code i.e. program.cs I need to identify if the app is running either in Teams or as a standalone web app. This is to properly configure authentication to suit the specific environment before app.Run(), as I need the app to be able to run as either Teams-hosted or standalone web.
For Personal apps, in your manifest you are able to specify a contentUrl, which is the url that is rendered for your app when inside Microsoft Teams, as well as a websiteUrl, which is what will get shown when your app is opened outside of the Teams context (e.g. if the user clicks the button to load the web view, or I think some mobile devices render this by default). See more here.
For a Channel or Chat tab, you have a "Configuration" page that the user sees first - the small popup for configuring your tab, and likewise here you set a contentUrl and a websiteUrl (see more here).
In both these cases, you can actually set the -same- url, but with a different querystring value to indicate to your backend which view it is, and then use that value to do what you need.
Related
I am working on teams tab, looking for a solution to stop teams tab redirecting to browser or redirecting to any website from website icon🌐 on top right corner.
For a configurable tab , in your config page you call setSettings().
There you specify:
the entityId,
contentUrl,
the websiteUrl,
and optionally the removeUrl
Here you can leave the websiteUrl empty/null/None
Note that you will need to provide a content contentUrl which will point to your angular app/site to render the tab in Teams.
However it is important to be aware that this may have impact on the way a mobile client renders the tab.
If you distribute your App via the tenant store , this will have no impact.
For a published store app (via Appsource), the app needs to be approved / whitelisted to use the url in contentUrl. (this should be handled by the AppValidation Team)
Apps that are approved for mobile will use the contentUrl
Non-approved apps will use the websiteUrl, and if you did not provide that , there is nothing to display😶.
This process is intended make sure existing Apps+Tabs properly render on mobile devices,
and is something to be aware of when design / deploying and sending the app for store approval.
https://learn.microsoft.com/en-us/microsoftteams/platform/tabs/what-are-tabs#mobile-clients
also see :
https://learn.microsoft.com/en-us/graph/api/resources/teamstabconfiguration?view=graph-rest-1.0
I'm making a custom tab app of MS Teams with ASP.NET, however, the tab doesn't seem to pass a same cookie between requests on MS Teams. So the ASP.NET app behind the tab generates a new Session.SessionID on every request.
I've checked the following question, and tried some settings according to that page, but nothing helped me. Actually my web site works nicely if I navigate it via Chrome or Edge.
ASP.NET: Session.SessionID changes between requests
How do I get a same cookie between requests on MS Teams?
I've not tested this specifically so haven't seen it, but basically the broad idea of session is to have to uniquely "remember" a user, and then restore State for them from a location (e.g. database). From your question, it seems like the out of box "Session" object is giving trouble, but at any rate you should probably avoid using it because it won't "remember" the user even across devices.
However, Teams provides you a way to achieve the same thing yourself quite easily. Remember that the Teams 'Context' object provides a userObjectId property that is unique and valid for the same user on all sessions on all devices (it's actually their Azure Active Directory id). You can simply store whatever you want in your own database, key'ed by this id, and request it on page load. It's also possible to get this from the querystring for a static (personal) tab if you want to handle the behaviour server-side (e.g. C#).
I'm planning to build a custom application for Ms Teams and I wanted the app to have an 'Administration' context, reserved for some users, with charts and records management that the rest of the users wouldn't be able to see. Is there a way to accomplish this?
Is it possible to hide tabs depending on a user profile? Is there another way to accomplish this on teams?
Tks
Inside your tab you can do whatever you want - it's just a custom web app/page. The only "restriction" aside from a normal web app, is that it must implement the Teams javascript library - see here for more. However, once you've implemented that library, you can get the Teams context, which includes the user's Azure AD Id and also UPN, and you could use one or both of those to do a lookup against your database, determine the user's role, and show/hide UI elements accordingly.
However, I think you might be asking about whether the entire Tab -itself- (i.e. even the tab item inside the Teams client) can be hidden from other users. To do this, an option is to use a "private channel", just for the relevant users, and pin the tab inside there only.
Question
How can I create a link to navigate to a Team's channel, from within a custom personal tab?
Context
I'm trying to navigate from within a personal tab to a Team the user is a member of. I've tried the only 2 options I can think of so far:
using an a tag
using microsoftTeams.executeDeepLink
But they don't work.
When clicking the a tag, the tab contents are redirect to the general MS Teams navigation page, where you can choose to open in client or web.
When using the microsoftTeams.executeDeepLink function, a result is returned containing the error message The executeDeepLink API is not implemented in this client.
It seems the API only works on team (configurable) tabs on the desktop client.
#Nsevens This feature is not public yet. Could you please try this in the Developer Preview
WP7 newbie here..
In my application, I am using embedded web browser control to load an external web page.
I have a PIN based validation step in that application, which involves
1) User Leaving the current application, (which has a external web page loaded in the embedded web browser) to launch the SMS Inbox.
2) User reads the SMS he just received, which has the PIN. I am sending this SMS to the user.
3) The User then needs to resume back to the original application by hitting back button, to enter the PIN which he received in the SMS earlier.
Once user enters Step2, my application will go into background, and subsequently will get tombstoned. Once user enter Step3, I want to restore application state (with the embedded web browser control), without making a fresh HTTP request again to load the web page.
So, with the given scenario in my mind, I have following two questions -
1) Is there a better way to do all this, like not having to exit the original application, and still let user read the SMS. ( i.e any api to read sms ?)
2) Is there a way to serialize the browser state/save entire web page (with images, css, js) , such that entire web page can be rendered exactly the way it was, when user left the running application.
Important points:
1) I can only use SMS as a communication channel. I can not use something like raw push notification channel, which could let me show PIN to the user, without exiting the application.
2) I am targeting Windows phone 7.0 runtime, but if there is a better option available in Windows Mango update, please do tell me.
Any sort of help is greatly appreciated.
Update:
Added link to the embedded web browser component.
1) There is no API that would let you access the contents of the Messaging hub from inside your application. This is set up for privacy purposes.
2) By default, the web browser saves its state. So if you navigate away from your app, and then come back - the same web page will still be there unless you explicitly re-navigate on activation
1) The better way to do this would be to not embed the web page within an app. Just build a mobile website. If all the functionality is within the web page you gain nothing but problems by trying to put it inside an app.
The web browser control is not intended to be used to create an alternative browser (which is really what you're doing).
2) You can try using the SaveToString() method to store the state of the page when tombstoned but this doesn't allow for modifications to the page since it was loaded (including anything dynamically updated or any state in javascript). If you have multiple pages you'll also need to maintain the internal backstack and the state of each page separately.
Short answer: If you want to put your application logic in a webBrowser control then you can't support tombstoning. Fast-App-Switching (in Mango) partially addresses this but not completely.