Forum Discussion

Karunakaran_GN's avatar
Karunakaran_GN
Copper Contributor
Apr 05, 2023

How to launch a link in Teams Tab or Popup?

Hi, 

Currently when a user clicks on a hyperlink in chat, user will be redirected to external browser to launch the link. I have a requirement to launch the link within Teams (in a tab or pop up or any other way). Is there a way to achieve this?

    • Karunakaran_GN's avatar
      Karunakaran_GN
      Copper Contributor

      Thanks Sayali for the response!!

      My requirement is, I have 2 buttons in my adaptive card. On clicking fisrt button https://abc.com site should be launched and on clicking second button https://xyz.com should be launched. With in teams, either in a tab or modal window(or if there is any better way). Currently on button click the URL is being launched in external browser.
      I am able to add a personal tab to my application and create deeplink tot he same, on click of deeplink focus is being shifted to the tab but the problem is URL in personal tab is static, I want it to be dynamic such that on runtime I can pass the URL to be launched in the tab.

      • Sayali-MSFT's avatar
        Sayali-MSFT
        Icon for Microsoft rankMicrosoft

        Karunakaran_GN -Please have look into this sample-
        Microsoft-Teams-Samples/DeepLinkBot.cs at main · OfficeDev/Microsoft-Teams-Samples (github.com)

            public Attachment AdaptiveDeepLinkCard(string userName, ITurnContext turnContext)
                {
                    if (turnContext.Activity.Conversation.ConversationType == "channel")
                    {
                        channelID = turnContext.Activity.Conversation.Id.Split(';')[0];
                        tabUrlTask1 = deeplinkHelper.GetDeepLinkToChannelTask(teamsUrl, _configuration["MicrosoftAppId"], _configuration["BaseURL"], channelID, _configuration["ChannelEntityId"], "bot1");
                        tabUrlTask2 = deeplinkHelper.GetDeepLinkToChannelTask(teamsUrl, _configuration["MicrosoftAppId"], _configuration["BaseURL"], channelID, _configuration["ChannelEntityId"], "bot2");
                        tabUrlTask3 = deeplinkHelper.GetDeepLinkToChannelTask(teamsUrl, _configuration["MicrosoftAppId"], _configuration["BaseURL"], channelID, _configuration["ChannelEntityId"], "bot3");
                        extendedDeepLink = deeplinkHelper.GetDeepLinkToChannelTask(teamsUrl, _configuration["MicrosoftAppId"], _configuration["BaseURL"], channelID, _configuration["ChannelEntityId"], "");
                    }
                    else
                    {
                        tabUrlTask1 = deeplinkHelper.GetDeepLinkToTabTask(teamsUrl, _configuration["ManifestAppId"], _configuration["TabEntityId"], "topic1");
                        tabUrlTask2 = deeplinkHelper.GetDeepLinkToTabTask(teamsUrl, _configuration["ManifestAppId"], _configuration["TabEntityId"], "topic2");
                        tabUrlTask3 = deeplinkHelper.GetDeepLinkToTabTask(teamsUrl, _configuration["ManifestAppId"], _configuration["TabEntityId"], "topic3");
                        extendedDeepLink = deeplinkHelper.GetDeepLinkToTabTask(teamsUrl, _configuration["ManifestAppId"], _configuration["TabEntityId"], "");
                    }
  • ccv_o's avatar
    ccv_o
    Copper Contributor
    Hi! Were you able to figure this out? I have this same task currently

Resources