TransWikia.com

How to get SharePoint site URL associated with Microsoft Teams

SharePoint Asked by Rohit Kharade on December 24, 2021

Is there any way (C# or PowerShell) by which we can get SharePoint Site URL associated with Microsoft Teams ? If anyone has code/script for the same , kindly share .
Any kind of suggestion will be helpful .

3 Answers

You can build the SharePoint url using Microsoft Teams PowerShell command

Get-Team  | Select MailNickName

The SharePoint url shall then be $yourtenant.sharepoint.com/teams/$MailNickName
MailNickName looks like "team_xxxxx"

Answered by Thierry Dalon on December 24, 2021

From Microsoft Teams PowerShell run the following command:

$Teams = (Get-Team |Select-Object GroupId, DisplayName)
ForEach ($T in $Teams) {$SPOURl = (Get-UnifiedGroup -Identity $T.GroupId | Select -ExpandProperty SharePointSiteURL) Write-Host “URL for the” $T.DisplayName “Microsoft Team is” $SPOURL}

The command provides us the following information:

  • SharePointSiteURL
  • SharePointDocumentsURL
  • SharePointNotebookURL

Answered by Thierry Dalon on December 24, 2021

We came across your question while researching a similar problem. To my knowledge there is no simple way of doing this.

In the end we decided on a combination of the Microsoft Graph API to retrieve all of the Microsoft Team IDs and then we used the DO_NOT_DELETE_SPLIST_TENANTADMIN_AGGREGATED_SITECOLLECTIONS list from the SharePoint admin center to connect the Team to its corresponding site collection. This funny named list is actually used in the new SharePoint admin center and it has some useful information. Unfortunately it does not have a field that would say if it was a Microsoft Teams site, but thankfully it does have a field that tells you if you are dealing with an Office 365 group.

We did try other more direct solutions like the Exchange Online Remote Powershell but we either could not retrieve the site URL for private Teams, or we could not determine if an Office 365 Group even was a team.

I wrote a blog post about this matter and it describes in more detail how the URLs can be retrieved.

Hopefully it helps somebody in the future.

Answered by Vinko Bedek on December 24, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP