We're working on an app for Microsoft Teams where we need to make some tabs visible or not at runtime, depending on tenant and user permissions. So for example:
Some tabs should be visible to some tenants and not to others (depending on a service call to our API's).
Some tabs must be visible to Teams admins but not to normal users.
These are all personal tabs BTW. I can't find anything in the docs that would help in this regard. Seems the tabs are fixed by the manifest and will show the same for all users.
Can this be done? how? I might settle for any feasible workarounds.
As such there no direct way to do that .
However you can have ConfigureTabs and when you add that tab to a channel configure page, it will show up. You can then get the context and check what you want to do with that specific team (Maybe need to use Graph API to get more info with team Id).
This logic will run on the configuration page when the user selects to save. You can have a tab according to the logic.
microsoftTeams.settings.registerOnSaveHandler((saveEvent) => {
microsoftTeams.settings.setSettings({
websiteUrl: "https://your-website.com",
contentUrl: "https://your-website.com/red",
entityId: "redIconTab",
suggestedDisplayName: "MyNewTab"
})
saveEvent.notifySuccess()
})
This can't be done with multiple config tabs or with static tabs.
About showing tabs to some users, that is also not possible directly with the manifest.
However, you can use getContext and get the userObjectId, based on which we can show a page maybe saying "You don't have permission".
Related
We want to check what areas are used by user when they login to CRM. I have tried the recentlyvieweditems.
Is there any other way we can achieve this.
I do not think there is any solution or way to find out what area are clicked unless you login as that user and check what that user clicked.
The closest you can reach to get some insight for users and which entites they are accessing.
Organization insight solution
You have to capture those user telemetry data like - pages navigated, opened entity records, clicked ribbon buttons, etc using Application Insights or your own Database through your own API for all the breadcrumbs.
There is no other native solution other than Org Insights, that too available from 2016 onwards IIRC. Later they took different diversions during CRM online version upgrades.
You may try the EnableRule of application level command bar button to run your custom JS code to log user navigation. I haven't used it ever, but this is what I would try in your given scenario and I don't see any reason if it wouldn't work.
Create new custom entity/table with User ID/Name and URL attributes/columns
Create a application level command bar button
How do I add a global button (for all entities) on the CRM 2013 Command Bar
In button's enable rule, Add user id/name and document.location.href values as a new record to the custom table.
Create entity record through Javascript , CRM 2013 , SDK.Rest.CreateRecord
Don't forget to return false from the code in 'enable rule' so that the button should not actually be shown anywhere in the application.
If you go into amend Settings for a custom tab that you have created before, is there anyway to get the existing websiteUrl and contentUrl values in your configuration page?
The microsoftTeams.getContext method doesn't seem to make these Urls available (like it does entityId).
Thanks.
I think you'll need to persist this your side (e.g. in a database), and re-query them from your settings page. This is exactly why the "save" button won't become enabled until you're ready for it (by calling microsoftTeams.settings.setValidityState) - it's for your code to do whatever it needs before allowing the user to actually save any changes.
I have created custom application with static tabs defined in manifest file and it is working fine.
Now, our requirement is that we need to render static (personal) tabs dynamically according to provided Site URL by customer.
For ex. When application installed in teams user will get screen where he will asked for Site URL (API) in textbox and submit it. This will internally check data and give response with tab name, tab URLs and other details then I need to render this tabs dynamically in teams.
enter image description here
Please provide solution for this how I can achieve this ?
It is not possible to add static tabs dynamically. Static or personal tabs are always added through the app manifest and are common to all the users using the app. If you want to configure what tabs to show you can try using a channel tab.
As Gousia said, you can't set the contents of the tab dynamically, and you can't add/remove personal tabs programmatically, but what you could try is having your "tab" be just an iframe host, with width/height basically set to 100%, and then dymically loading the content of the iframe
I've got a problem with assigning my custom app to a team in MS Teams. So after uploading the app and trying to assign a new tab for it, I can't save the Tab.
Do you have any explanation for this? Already checked the validDomains and websiteURL.
Thanks!
It's important to know there are two kinds of tabs:
Personal tabs - if you want the user to have a personal tab experience, like where your app gets installed by a user directly, and appears in the App list on the left of the screen, then this is a "personal" tab.
Channel/Group Chat tabs - these are tabs that can be added to an existing channel or an existing group chat. For these kinds of tabs, when the user adds the tab, they have a small popup that appears that allows them to configure the tab itself. For instance, let's say your tab was going to show News - this configuration screen would let the user who's installing the tab to the channel/team be able to choose from a list of News sources they want to the tab to actually show. When you configure a tab like this in the manifest for your app, you're actually telling it the address for this "configuration" screen, which will set the actual final url for the tab itself.
Inside this small configuration popup, you need to tell Teams when the configuration you offered to the user is complete. For instance, if they have made a choice of which News feed they want, you would notify Teams that the configuration is finished, and that Teams can now "activate" the Save button. You can see more about this over here.
Of course, in many cases, the tab won't have any required configuration. In that case, you can immediately tell Teams to enable the Save button. A sample of this would be:
document.addEventListener("DOMContentLoaded", function (event) {
microsoftTeams.initialize();
microsoftTeams.getContext(function (context) {
microsoftTeams.settings.registerOnSaveHandler(function (saveEvent) {
microsoftTeams.settings.setSettings({
entityId: "WhatEverUniqueNameYouWantForYourTab",
contentUrl: "https://ThePathToYourActualTab",
suggestedDisplayName: "WhateverYouWantTheTabToBeCalled",
websiteUrl: "https://OptionalAddressForIfTheyWantAFullScreenExperience",
removeUrl: "https://OptionalAddressForARemoveExperience",
});
saveEvent.notifySuccess();
});
microsoftTeams.settings.setValidityState(true);
});
});
So, to be clear, if you want to add a Tab app for a Channel or Group Chat, you basically need to have two pages in your solution - the main tab page, and a page that will appear in the popup you've shown in your original question.
We have a requirement where support for different users in different tabs of a browser window. How can we achieve this in Spring 2.5? The application is based on Users, where users will have their own agents and articles. An internal user should be able to login to different user accounts in different tabs at same time and manipulate their data. Any help is much appreciated.
A browser's cookie store does not distinguish between different windows or tabs when deciding what cookies to send. So a cookie based approach won't help.
My suggestion for an alternative would be to have a hidden "userName" parameter that is passed back and forth as a URL query parameter for all requests from a given tab or window. You could finesse the setting of the parameter in browser requests by using some Javascript to add a hidden parameter to each of the HTML forms in the page just loaded. The parameter value would be snarffed from the query string of the current page URL. You'd just need to make sure that all pages included stuff in the header to load the JS and run it when the page load completed.
Generally speaking, no, because all of the tabs within the browser window share the same cookies.
One way to do it would be use multiple domain names all pointing at the same app. Each domain name would have its own set of cookies. You would need to have some way of switching to a new domain name after you open a new tab.
How about, have a set of bookmark toolbar bookmarks, each corresponding to a different domain name. Control-click on the bookmark and it opens in a new tab. You could provide the users links in your navigation to the different domains that they can drag onto their toolbar.
Depending on what browsers your users are using you could get even slicker - in some browsers Javascript window.open() opens a new tab. You could have the JS compute the new domain name before the window.open().