0

I have been trying to open SharePoint's sharing dialog using microsoftTeams.tasks.startTask() in my MS Teams application and it shows an infinite loader in desktop client. As I have come across certain articles and open threads, MS Teams does support redirecting within an iframe. Opening SharePoint's sharing URL goes through the authentication first (internal redirecting using login.microsoftonline.com)

Things I have tried so far -

var currentTeamsSiteUrl = new URL(currentItem['teamSiteUrl']);
var sharingDialogUrl = `${currentTeamsSiteUrl.href}/_layouts/15/sharedialog.aspx?listId=${currentItem['ListID']}&listItemId=${currentItem['ItemID']}&clientId=sharePoint`;
var src = `${currentTeamsSiteUrl.href}/_layouts/15/teamslogon.aspx?spfx=true&dest=${encodeURIComponent(sharingDialogUrl)}`;
                
                microsoftTeams.tasks.startTask({
                    title: "Share Item",
                    height: 560,
                    width: 350,
                    url: src,
                    fallbackUrl: null,
                    card: null,
                    completionBotId: null,
                });

The issue I am facing in desktop client is in attached screenshot - enter image description here

Interestingly enough, the code works if I run the application in browser, and not in the MS Teams Desktop Client.

I have added *.sharepoint.com, login.microsoftonline.com as a valid domains in application config json.

I have tried opening the sharing URL using window.open() - opens up browser from desktop client and new tab from browser, and as per Microsoft's scholars using Task Module is far better approach, but that is not working in desktop client. Again, not an elegant solution.

I have been trying to find a workaround for sharing dialog not running in MS Teams desktop app and it all comes down to the error shown in the attached screenshots. I tried allowing third-party cookies for and other different solutions (https://learn.microsoft.com/en-us/microsoftteams/troubleshoot/teams-sign-in/sign-in-loop) to make it work but no luck so far.

Any help would be appreciated. Cheers!

  • Take a look at the X-Frame-Options header: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options The response header you are getting back from https://login.microsoftonline.com/ does not allow the browser to render it inside an – Prasad-MSFT Nov 15 '21 at 12:11
  • @ChetanSharma-msft Nope, still looking for an answer. – psspl-krunalrohit Dec 13 '21 at 13:53
  • Could you please Set the X-FRAME-OPTION response header to SAMEORIGIN. The steps for configuring the X-Frame-Options settings are described in this article(https://knowledgebase.progress.com/articles/Knowledge/How-to-prevent-clickjacking-with-Sitefinity) – Prasad-MSFT Dec 14 '21 at 05:40
  • @Prasad-MSFT Thanks for your reply. However, the solution suggests to make few changes in IIS, and I do not have that. I am using MS Teams and SharePoint Online. – psspl-krunalrohit Dec 15 '21 at 09:48
  • Alternately, set header `X-Frame-Options: ALLOW-FROM https://teams.microsoft.com/`.(https://learn.microsoft.com/en-us/microsoftteams/platform/tabs/how-to/tab-requirements) – Prasad-MSFT Dec 17 '21 at 09:39

0 Answers0