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.
9,978 questions
SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
10,589 questions
SharePoint Development
SharePoint Development
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Development: The process of researching, productizing, and refining new or existing technologies.
2,943 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,207 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Maycon Batista 331 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.


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.