In Focus

Connect SharePoint Site To Office 365 Group

In this article, we will explore how we can connect a classic SharePoint site to an Office 365 group using UI and scripted approach.

Overview

 
Transforming classic SharePoint sites to modern SharePoint involves the ability to connect to Office 365 groups from a classic SharePoint site. Connecting the classic SharePoint site to the Office 365 group brings the site one step closer to modernization.
 
In this article, we will explore how we can connect a classic SharePoint site to an Office 365 group using UI and scripted approach.
 

Benefits of connecting to Office 365 Group

 
When a SharePoint site is connected to an Office 365 group, we can get the benefits of the group-connected services like Microsoft Planner and Microsoft Teams.
 
Microsoft planner is a simple and visual way to organize the work. It helps to easily create new plans, task management, share files, chat, and get progress on work status. The planner can be accessed from here.
 
Connect SharePoint Site to Office 365 Group 
 
Microsoft Teams is a hub for team collaboration in Office 365. It helps to collaborate with people, tasks, and files. Teams brings everything together in a shared workspace. Microsoft Teams can be accessed from here.
 
Connect SharePoint Site to Office 365 Group
 

What happens in the background while connecting a SharePoint site to an Office 365 Group?

 
Connecting a classic SharePoint site to an Office 365 group brings the below changes,
  • New office 365 group is created and is connected to the SharePoint site
  • A new modern page is created on the SharePoint site and is set as home page
  • Owners specified in group creation become the site collection administrators on the SharePoint site
  • Owners specified in group creation are added to the Owners group on the SharePoint site
  • Members specified in group creation are added to the Members group on the SharePoint site
Once the SharePoint site is connected to the Office 365 group, it works like a modern group-connected SharePoint site. Users can be added to the SharePoint site from Office 365 groups.
 

Connecting SharePoint sites to Office 365 Groups from UI

 
User Interface is the simplest option to connect classic a SharePoint site to an Office 365 group.
  1. Open classic SharePoint site.
  2. Click gear icon, select “Connect to new Office 365 Group”.

    Connect SharePoint Site to Office 365 Group

    This opens a wizard to walk through the process of Office 365 group creation and connecting it to the SharePoint site. Please note that this option is only available on non-publishing SharePoint sites.

  3. Click “Let’s get started”.

    Connect SharePoint Site to Office 365 Group

  4. Specify the group name. By default, the SharePoint site title is taken as the group name (if available). You may change the group name if needed. Specify the optional site description. Choose the privacy settings for Office 365 group as public or private.

    Connect SharePoint Site to Office 365 Group

  5. Click “Connect group”.
  6. Specify additional owners and members. These owners and members will also be added to the SharePoint site as owners and members respectively.

    Connect SharePoint Site to Office 365 Group

  7. Click "Finish".
Once the process is finished, a modern page named “Home(1).aspx” is added to the SharePoint site and set as a home page.
 
Connect SharePoint Site to Office 365 Group 
 

Connecting SharePoint site to Office 365 Group using PowerShell Script

 
PowerShell script option is good for developers and administrators to automate the process. Our Office 365 tenant has thousands of sites. Following the UI process on each of the sites is very time consuming. This process can be automated with the help of PowerShell script.
 
Set-SPOSiteOffice365Group helps to connect top level site collection to new Office 365 group.
  1. $UserName = "user@tenant.onmicrosoft.com"   
  2. $SPOAdminCenterUrl = "https://tenant-admin.sharepoint.com"   
  3. $ClassicSPOSite = "https://tenant.sharepoint.com/sites/ClassicSPOSite/"   
  4.   
  5. $O365Cred = Get-Credential -UserName $UserName  
  6. Connect-SPOService -Url $SPOAdminCenterUrl -Credential $O365Cred   
  7.   
  8. $GroupDisplayName="<Group Display Name>"   
  9. $GroupAlias="<GroupAlias>"   
  10. Set-SPOSiteOffice365Group -Site $ClassicSPOSite -DisplayName $GroupDisplayName -Alias $GroupAlias -IsPublic $true  

Connecting SharePoint site to Office 365 Group using CSOM API

 
CSOM API can be used as an alternative to PowerShell script for automating the process.
  1. using System.Security;  
  2. using Microsoft.SharePoint.Client;  
  3. using Microsoft.Online.SharePoint.TenantAdministration;  
  4. using Microsoft.Online.SharePoint.TenantManagement;  
  5.   
  6. .  
  7. .  
  8. .  
  9.   
  10. var pwd = "mypassword";  
  11. var passWord = new SecureString();  
  12. foreach (char c in pwd.ToCharArray()) passWord.AppendChar(c);  
  13.   
  14. ClientContext ctx = new ClientContext("https://tenant-admin.sharepoint.com/");  
  15. ctx.Credentials = new SharePointOnlineCredentials("admin@mydomain.com", passWord);  
  16. Tenant tenant = new Tenant(ctx);  
  17. tenant.CreateGroupForSite("https://tenant.sharepoint.com/sites/ ClassicSPOSite ""display-name-for-group""alias-for-group"true);  

Verify Office 365 Group 

  1. Open Microsoft 365 Admin Center.
  2. Click "Groups" from the left navigation.
  3. Our created Office 365 group should appear in the list.
Connect SharePoint Site to Office 365 Group
 

Summary

 
Being able to connect to Office 365 group from classic SharePoint site is a crucial step for modernizing the SharePoint site. It enables us to get the benefits of the group-connected services like Microsoft Planner and Microsoft Teams.