Need to open url in Teams Application

Robin Singh 0 Reputation points
2024-09-13T11:11:27.5366667+00:00

i have a custom teams application which has url on its page and i need to open those urls in teams only

Microsoft Teams
Microsoft Teams
A Microsoft customizable chat-based workspace.
10,089 questions
Microsoft Teams Development
Microsoft Teams Development
Microsoft Teams: A Microsoft customizable chat-based workspace.Development: The process of researching, productizing, and refining new or existing technologies.
3,250 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Maycon Batista 336 Reputation points
    2024-09-13T19:38:36.0333333+00:00

    Hello Robin,

    To open URLs within Microsoft Teams from your custom application, you can use the Teams JavaScript SDK. Here’s a basic example of how you can achieve this:

    1. Install the Teams SDK: Make sure you have the Microsoft Teams JavaScript SDK installed in your project. You can add it via npm:
    npm install @microsoft/teams-js
    
    1. Initialize the SDK: Initialize the Teams SDK in your application
    import * as microsoftTeams from "@microsoft/teams-js";
    

    microsoftTeams.initialize();

    1. Open URLs in Teams: Use the microsoftTeams.executeDeepLink method to open URLs within Teams.
    function openUrlInTeams(url) {
        microsoftTeams.executeDeepLink(url);
    }
    // Example usage
    openUrlInTeams("https://your-url-here.com");
    

    This will ensure that the URLs open within the Teams environment rather than in a new browser window.

    If there are any misunderstandings, please let me know

    Best regards,

    Maycon Novaes

    If the Answer is helpful, please click "Accept Answer" and upvote it.


  2. Alexis CONIA 0 Reputation points MVP
    2024-10-02T08:48:03.7066667+00:00

    If the URL of your link differs from your app's URL, you need to specify the URL in the validDomains section of your app manifest. By default, Teams blocks URLs that are not specified

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.