About Me

My photo
Muthupet, TamilNadu, India
SharePoint 2010

Friday, July 9, 2021

Create a Team From Existing SharePoint Online Modern Team Site Using PowerShell

How to create a team in Microsoft Teams from an existing SharePoint Online modern team site (connected to Office 365 group) using PowerShell.

 
I have created a modern team site (connected to an Office 365 group) and created multiple document libraries and lists in the site. I want to create a Team in Microsoft Teams using this site so that files will be shared in this SharePoint site instead of creating a new site and also, I can have the same site structure (document libraries, lists etc.) which was already created.

  1. # Input Parameters  
  2. $siteURL="https://c986.sharepoint.com/sites/ukcommunicationsitedemo"  
  3. $tenantURL="https://c986-admin.sharepoint.com"  
  4. $credential = Get-Credential  
  5.  
  6. ## Connect to Microsoft Teams  
  7. Connect-MicrosoftTeams -Credential $credential  
  8.  
  9. ## Connectto SharePoint Online Service  
  10. Connect-SPOService -Url $tenantURL -Credential $credential  
  11. $site = Get-SPOSite -Identity $siteURL  
  12.  
  13. ## Create a new Team  
  14. New-Team -GroupId $site.GroupId.Guid