1
votes

I have installed an app in a tab and wanted to redirect to another tab.

The url of the tab is of the form https://teams.microsoft.com/l/channel/<entityId>/<tabId>?label=Wiki&groupId=<groupId>&tenantId=<tenantId>

For doing this I have tried the following -

  1. window.location.href= url //Tabs Url

    When viewing the console, I see a mixed content error saying that msteams is being accessed from https page. This is inspte of the fact that I am redirecting to a https url. Also, no redirection.

  2. microsoftTeams.navigateCrossDomain(url);

    Shows in the console that this method is deprecated but nothing on the documentation page and no redirection.

  3. microsoftTeams.navigateToTab(tabName...)

    No error or any redirection

1. What should I change for redirection to be successful?

2. What is the proper way to do this?

Edit 1:

The link that I have posted in the question is a deep link.

The problem does not lie in redirection. I can directly enter the url in the address bar and get redirected to the tab. The issue lies with getting this screen.

Teams Screenshot

It appears even when I am within Teams desktop app and no redirection takes place after that. If I do the same process via the Teams web app, I can open the console and see a mixed content warning error that a https page is trying to call a msteams url.

When I directly enter this url in browser, even though this screen appears my teams app is able to display the channel.

Note -

  1. navigateCrossDomain does not redirect instead prints to console that it is deprecated.
  2. navigateToTab also does not seem to do anything as it is not printing any error in console nor is it performing any redirection.

Edit 2 -

  1. I tried opening the Teams web app in Edge and it's able to redirect properly using window.location.href.

What doesn't work

  1. Redirecting inside Teams desktop app

  2. Redirecting in Teams web app in Chrome

  3. Redirecting using navigateCrossDomain()

1
I have updated the question to reflect that the problem is not with the link. - Ashutosh
Redirection to another tab only works when I open the teams app in Edge and then redirect which opens my team app with the new channel. No other browser will work. - Ashutosh

1 Answers

2
votes

There are two options to navigate to another channel tab:

  1. Create a tab deep link and provide hyper link with target="_blank". This would open up the link in browser first and then take you to channel tab.
  2. Get Tab details using getTabInstances() and use navigateToTab() to perform navigation. Note: This method takes TabInstance as parameter.