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 .


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.

| improve this answer | |

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
| improve this answer | |

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"

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.