OfficeDev / microsoft-teams-library-js

JavaScript library for use by Microsoft Teams apps
https://docs.microsoft.com/microsoftteams/platform/
Other
426 stars 193 forks source link

"teamSiteUrl" returns different things on different platforms for the same app #918

Open nbelyh opened 2 years ago

nbelyh commented 2 years ago

I'm trying to use teamsSiteUrl field from teams context passed to personal tab (that is not part of any team).

The code:

microsoftTeams.getContext(teamsContext => {
  console.log(teamsContext.teamSiteUrl);
});

The result in web and desktop client is: https://<sharepointsite>.sharepoint.com The result on android is: undefined The result on iOS is: https://<sharepointsite>.sharepoint.com/_layouts/15/sharepoint.aspx

πŸ˜•???

I would expect this to work (or not work) the same way on all platforms πŸ˜„ Is it a bug or???

ghost commented 2 years ago

Hi nbelyh! Thank you for bringing this issue to our attention. We will investigate and if we require further information we will reach out in one business day. Please use this link to escalate if you don't get replies.

Best regards, Teams Platform

ChetanSharma-msft commented 2 years ago

@nbelyh - Could you please share the repro steps with manifest so that we can check it from our end?

nbelyh commented 2 years ago

@v-chetsh Basically, it should be reproducible with any "personal tab" application, i.e. if you have in the (default) manifest:

  "staticTabs": [
    {
      "scopes": ["personal"],
      "context": ["personalTab"],
      "contentUrl": "<bla-bla-bla>/the-file.below.html"
    }

the-file-below.html

<script src="https://statics.teams.cdn.office.net/sdk/v1.11.0/js/MicrosoftTeams.min.js"></script>
<script>
  microsoftTeams.initialize();
  microsoftTeams.getContext(teamsContext => {
    console.log(teamsContext.teamSiteUrl);
    document.getElementById("output").textContent = teamsContext.teamSiteUrl;
  });
</script>
<body>
<div id="output" />
</body>

Just add the tab on desktop / android / ios to see the difference I could try to make a minimalistic application later on if needed, but maybe this information is sufficient?

Note: it works properly (returns the team's site url on all platforms) if used from a "configurable tab". I would just expect some consistency here, i.e. I would expect it to work the same way on all platforms.

ChetanSharma-msft commented 2 years ago

@nbelyh - Thanks for sharing the information. We will check on it from out end and let you know the updates.

sayali-MSFT commented 2 years ago

@nbelyh -We are tried to repro the scenario. But it's working fine for us. did not get the undefined with android. Teams Version:-1416/1.0.0

MicrosoftTeams-image (4)

nbelyh commented 2 years ago

Have you added the app to a team? You need to add the app as a personal tab (not to a team). It cannot say any specific site (e.g. "Retail" in your case) because personal tab has no site. This is the point - the personal app has no team, and therefore no site. In this scenario, different clients show different things.

sayali-MSFT commented 2 years ago

@nbelyh -It is not Bug. As per document the "teamSiteUrl: The root SharePoint site associated with the team" and as you mention above " the personal app has no team, and therefore no site". Reference Doc:-https://docs.microsoft.com/en-us/microsoftteams/platform/tabs/how-to/access-teams-context#get-context-by-using-the-microsoft-teams-javascript-library

nbelyh commented 2 years ago

@sayali-MSFT My point was, I expected this property to be the same on all platforms: empty, root site (would prefer), or whatever... The thing, now it's different per-platform (i.e. android/web/ios). So that developers can either rely on it (like me - I was erroneously assuming it's always set to the root site like in case of web or desktop), or not rely on it's value at all (if it was always empty)

sayali-MSFT commented 2 years ago

@nbelyh -We are checking it internally with engineering team and let you know once we get any updates.

sayali-MSFT commented 2 years ago

@nbelyh -We are able to repro that issue , We have raised bug for the same and concerned team is looking into it. We will inform you once we get any update.

sayali-MSFT commented 2 years ago

Engineering team working on this issue. Currently we don’t have ETA or Update on this thread. We will update this thread once the bug is fixed.

sayali-MSFT commented 1 year ago

We are checking the status of the fix release with the engineering team. We will let you know once we have any updates on it. Thanks.

ChetanSharma-msft commented 1 year ago

I apologize for delay in response. We are actively checking the status of bug fixes with engineering team and will update this thread accordingly.

Thanks!!

sayali-MSFT commented 1 year ago

hope you are doing well!

I wanted to inform you that we are currently checking the status of the bug with the engineering team. Once we receive any updates, we will promptly inform you.

Thank you!