Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to open SharePoint pages using stageview inside Microsoft teams for ios and android #11785

Open
harshdamaniahd opened this issue Nov 7, 2024 · 10 comments
Assignees
Labels
needs-attention teams-developer-support Question related to extensibility (Bot, ME, Tab) would be marked under this label

Comments

@Nivedipa-MSFT
Copy link

@harshdamaniahd - Thank you for your inquiry about your Teams app development issue!
The only officially supported mechanisms for integrating SharePoint content in Teams are the built-in SharePoint, SharePoint Pages, and Lists apps as documented here:
https://support.microsoft.com/en-us/office/add-a-sharepoint-page-list-or-document-library-as-a-tab-in-teams-131edef1-455f-4c67-a8ce-efa2ebf25f0b

Or Viva Connections for a portal experience:
https://learn.microsoft.com/en-us/viva/connections/edit-viva-home#choose-the-default-landing-experience-for-viva-connections-desktop

Using custom apps is only supported for SPFx-based solutions and in that case, very specific guidelines need to be followed when creating the app manifest:
https://learn.microsoft.com/en-us/sharepoint/dev/spfx/deployment-spfx-teams-solutions#developer-provided-microsoft-teams-app-manifest--package

The most important requirements are:

The TeamsLogon.aspx redirect should be used to handle authentication. The contentUrl should look like this:
https://{teamSiteDomain}/_layouts/15/TeamsLogon.aspx?SPFX=true&dest=/sites/CustomerSite.aspx

A webApplicationInfo section should be added to the manifest that looks like so:

"webApplicationInfo": {
  "resource": "https://{teamSiteDomain}",
  "id": "00000003-0000-0ff1-ce00-000000000000"
} 

Please let us know if you have any further query here.

Thank You,
Nivedipa
Developer Community Response Team

@harshdamaniahd
Copy link
Author

Hey Thanks for the reply @Nivedipa-MSFT . But you did not understand me correctly.
I would like to open a sharepoint page directly inside teams instead of browser. how can i do this using stageview or deeplink

@Nivedipa-MSFT
Copy link

Nivedipa-MSFT commented Nov 13, 2024

@harshdamaniahd - We are checking this with engineering team, we will let you know once we get any updates on it.

@Nivedipa-MSFT
Copy link

@harshdamaniahd - The engineering team has provided feedback regarding the loading of SharePoint content within a stage. They mentioned that while it is possible for the app developer to load SharePoint content using the TeamsLogon.aspx redirect, this method is not officially supported unless the content being loaded is an SPFx web part.

For a more reliable solution, it is recommended to direct the user to a browser to access the SharePoint content, rather than attempting to load it within the stage. This approach ensures better compatibility and support.

Please let us know if you have any further query here?

@Prasad-MSFT Prasad-MSFT added needs-author-feedback Needs more info from the customer. and removed needs-triage 🔍 labels Nov 26, 2024
@harshdamaniahd
Copy link
Author

We have a usecase where we have a chatbot and that chatbot when sending messages sends a sharepoint page as well in content. The problem occurs for front line workers as they don't have desktop and only use phones. Sharepoint is not accessible from browser so only way is to open in teams. It worked earlier but doesn't work now 😢.

@microsoft-github-policy-service microsoft-github-policy-service bot added needs-attention and removed needs-author-feedback Needs more info from the customer. labels Nov 26, 2024
@Nivedipa-MSFT
Copy link

@harshdamaniahd - Thanks for your input. We will check this again with engineering team and get back to you soon.

@harshdamaniahd
Copy link
Author

@harshdamaniahd - Thanks for your input. We will check this again with engineering team and get back to you soon.

Should I raise feature request?

@Nivedipa-MSFT
Copy link

@harshdamaniahd - Have you tried using the TeamsLogon.aspx redirect for this?

@harshdamaniahd
Copy link
Author

Can you share an example?

@ChetanSharma-msft ChetanSharma-msft added the teams-developer-support Question related to extensibility (Bot, ME, Tab) would be marked under this label label Dec 31, 2024
@Nivedipa-MSFT
Copy link

@harshdamaniahd - Apologies for the delay.
Here is a basic example of a TeamsLogon.aspx page that you can use to handle user logins within your Teams app. This example assumes you are using ASP.NET and the Microsoft Teams JavaScript client library.

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TeamsLogon.aspx.cs" Inherits="YourNamespace.TeamsLogon" %>
 
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Teams Login</title>
    <script src="https://statics.teams.cdn.office.net/sdk/v1.11.0/js/MicrosoftTeams.min.js"></script>
    <script type="text/javascript">
        microsoftTeams.initialize();
 
        microsoftTeams.getContext(function(context) {
            // Use the context to get user details
            var userPrincipalName = context.userPrincipalName;
            var userObjectId = context.userObjectId;
 
            // Make an AJAX call to your server to log in the user
            var xhr = new XMLHttpRequest();
            xhr.open("POST", "TeamsLogon.aspx/LoginUser", true);
            xhr.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
            xhr.onreadystatechange = function () {
                if (xhr.readyState === 4 && xhr.status === 200) {
                    // Redirect to the main page after successful login
                    window.location.href = "MainPage.aspx";
                }
            };
            xhr.send(JSON.stringify({ userPrincipalName: userPrincipalName, userObjectId: userObjectId }));
        });
    </script>
</head>
<body>
    <form id="form1" runat="server">
    </form>
</body>
</html>

In the code-behind file TeamsLogon.aspx.cs, handle the login logic:

using System;
using System.Web.Services;
 
namespace YourNamespace
{
    public partial class TeamsLogon : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
        }
 
        [WebMethod]
        public static void LoginUser(string userPrincipalName, string userObjectId)
        {
            // Implement your login logic here, e.g., validate the user, create session, etc.
        }
    }
}

Manifest file example:

{

  "$schema": "[https://developer.microsoft.com/json-schemas/teams/v1.6/MicrosoftTeams.schema.json"](https://developer.microsoft.com/json-schemas/teams/v1.6/MicrosoftTeams.schema.json%22),

  "manifestVersion": "1.6",

  "version": "1.0.0",

  "id": "your-app-id",

  "packageName": "com.example.yourapp",

  "name": {

    "short": "Your App",

    "full": "Your Full App Name"

  },

  "description": {

    "short": "Short description of your app",

    "full": "Full description of your app"

  },

  "icons": {

    "color": "color.png",

    "outline": "outline.png"

  },

  "staticTabs": [

    {

      "entityId": "unique-id",

      "name": "Your Tab",

      "contentUrl": "https://{teamSiteDomain}/_layouts/15/TeamsLogon.aspx?SPFX=true&dest=/sites/CustomerSite.aspx",

      "scopes": [

        "personal"

      ]

    }

  ],

  "permissions": [

    "identity",

    "messageTeamMembers"

  ],

  "validDomains": [

    "{teamSiteDomain}"

  ]

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-attention teams-developer-support Question related to extensibility (Bot, ME, Tab) would be marked under this label
Projects
None yet
Development

No branches or pull requests

5 participants