microsoft / Viva-Connections-Extensibility-Beta

38 stars 6 forks source link

Teams notifications: opening Viva URL works / works not alternating #28

Closed Renevdo closed 3 years ago

Renevdo commented 3 years ago

Versions

[ Windows ] Operating System [ 10.22 ] Node version [ 3.9.1 ] Gulp version [ - ] SPFx Generator version (npm list -g @microsoft/generator-sharepoint)

Expected or Desired Behavior

Clicking on a notification in Teams, opens the Viva (SharePoint) URL. Clicking on another notification, opens also the Viva URL. The url to open is a Viva site, set in the TeamworkActivityTopic.WebUrl

Observed Behavior

Clicking on a notification works. Clicking on another notifications fails. This alternates exactly. Both URLs are working. When it fails, we see a request to: https://tenant.sharepoint.com/_layouts/15/preload.aspx?portalsCache=true&env=TeamsWebView and the initiator is registerBeforeUnloadHandler:

image

Steps to Reproduce

Create 2 or 3 Teams notifications with a WebUrl like this:

string `tabUrl` = $"https://graph.microsoft.com/v1.0/users/{subscribedUser.UserId}/teamwork/installedApps/{subscribedUser.AppId}";
string encodedContext = Uri.EscapeDataString("{\"subEntityId\": \"" + _model.Url + "\"}");

var notification = new TeamworkActivityTopic
{
     Source = TeamworkActivityTopicSource.EntityUrl,
    Value = tabUrl,
     WebUrl = $"https://teams.microsoft.com/l/entity/{appid}/{tabId}?context={encodedContext}"
};

The WebUrl is a reference to a static tab in Teams. In the Teams manifest of our app, Viva is opened. Url of Viva: https://tenant.sharepoint.com/_layouts/15/teamslogon.aspx?spfx=true&dest=https://tenant.sharepoint.com/sites/home?app=portals",

When clicking on the notification in Teams, and it doesn't work, we see a javascript call to registerBeforeUnloadHandler which does a _navigateToPreload. When this happens, the browser navigates to https://tenant.sharepoint.com/_layouts/15/preload.aspx?portalsCache=true&env=TeamsWebView and then it stops and nothing is displayed. When clicking on another notification, It works and navigates to the correct URL. This keeps alternating.

If we leave app=portals off the URL, it also keeps working!

Renevdo commented 3 years ago

Any pointers?

johnguy0 commented 3 years ago

@Renevdo This issue list is for tracking issues specifically with SPFx Viva Connections Extensibility e.g. Adaptive Card Extensions. Please open this issue on our standard issue list.