Forum Discussion

oskarkuus's avatar
oskarkuus
Copper Contributor
Dec 14, 2023

DeepLink to Viva connection to a specific SP page

How to build a deeplink to viva connection application and then deeplink to a specific sharepoint page that opens in the viva connection application?

 

Currently i have managed to use this link: https://teams.microsoft.com/l/entity/<id of viva connection app>/

 

This works, it opens the viva connection app.

But i want to point the link to a specific page in my SP site.

 

Anyone know how to do this?

8 Replies

    • SaiPratap-MSFT's avatar
      SaiPratap-MSFT
      Former Employee

      SaiPratap-MSFT - 

      To build a deep link to the Viva Connections application and then deep link to a specific SharePoint page that opens in the Viva Connections application, you can follow these steps:

      1. Get the ID of the Viva Connections application:

        • The ID of the Viva Connections application can be found in the Teams app manifest file or in the Teams admin center.
      2. Configure the deep link to the Viva Connections application:

        • Use the following format to configure the deep link to the Viva Connections application: https://teams.microsoft.com/l/entity/<appId>/.
        • Replace <appId> with the ID of the Viva Connections application.
      3. Generate a deep link to the specific SharePoint page:

        • To generate a deep link to a specific SharePoint page, you can use the SharePoint URL and append it to the deep link of the Viva Connections application.
        • Make sure to properly URI encode the SharePoint URL and replace any special characters with their encoded values.

      Here's an example of how you can generate the deep link:

      var vivaConnectionsAppId = "<id of viva connection app>";
      var sharePointPageUrl = "<URL of the specific SharePoint page>";
      
      // Encode the SharePoint URL
      var encodedSharePointPageUrl = encodeURIComponent(sharePointPageUrl);
      
      // Generate the deep link
      var deepLink = `https://teams.microsoft.com/l/entity/${vivaConnectionsAppId}/?webUrl=${encodedSharePointPageUrl}`;
      
      // Open the deep link in the Viva Connections application
      microsoftTeams.executeDeepLink(deepLink);
      

      In the above example, replace <id of viva connection app> with the actual ID of the Viva Connections application, and <URL of the specific SharePoint page> with the URL of the specific SharePoint page you want to deep link to.

      Make sure to properly URI encode the SharePoint URL using the encodeURIComponent() function to ensure that all query parameters and white spaces are encoded correctly.

      By executing the generated deep link using the microsoftTeams.executeDeepLink() function, the Viva Connections application will open and navigate to the specified SharePoint page.

      you can refer this doc : Microsoft Teams documentation on deep links 

      • oskarkuus's avatar
        oskarkuus
        Copper Contributor

        SaiPratap-MSFT 

        I can not get this to work.

        This is how i did.

         


        This is the result :

         

        https://teams.microsoft.com/l/entity/00000000-0000-0000-0000-ee00425598aa/?webUrl=https%3A%2F%2Fcompany.sharepoint.com%2Fsites%2Fnat%2FSitePages%2FMySite.aspx

         

         

        When i click on the link, it does open the viva connection app.

        But it does not go to my sharepoint page on that site. So the link is still not a deeplink, it just goes to the application.

         

         

        edit:

         

        i also tried this in powershell

        # Define variables
        $vivaConnectionsAppId = "00000000-0000-0000-0000-ee00425598aa"
        $sharePointPageUrl = "https://company.sharepoint.com/sites/net/SitePages/MyPage.aspx"
        
        # Encode the SharePoint URL
        $encodedSharePointPageUrl = [System.Web.HttpUtility]::UrlEncode($sharePointPageUrl)
        
        # Generate the deep link
        $deepLink = "https://teams.microsoft.com/l/entity/$vivaConnectionsAppId/?webUrl=$encodedSharePointPageUrl"
        
        # Open the deep link in the default web browser
        Start-Process $deepLink


        I get the same result.

Resources