Set-SPOSiteOffice365Group

Connects a top-level SPO site collection to a new Microsoft 365 Group.

Syntax

Set-SPOSiteOffice365Group
    -Site <string>
    -DisplayName  <string>
    -Alias <string>
    [-IsPublic]
    [-Description <string>]
    [-Classification <string>]
    [-KeepOldHomepage] 
   [<CommonParameters>]

Description

Connects a top-level SPO site collection to a new Microsoft 365 Group. You must be a SharePoint Online administrator or Global administrator to run the cmdlet and be a site collection administrator of the site.

If the site doesn't exist, this cmdlet returns a "File not found" error.

Examples

Example 1

This example creates a new Microsoft 365 Group named "site1group" and connects site collection https://contoso.sharepoint.com/sites/site1 to it. The group will have its privacy set to "Private" and Classification set to "Highly Confidential".

Set-SPOSiteOffice365Group -Site https://contoso.sharepoint.com/sites/site1 -DisplayName "site1group" -Alias "site1group" -Classification "Highly Confidential"

Example 2

This example creates a new Office 365 Group named "classicsite" and connects site collection https://contoso.sharepoint.com/sites/classicsite to it. It will keep the old home page from the classic site.

Set-SPOSiteOffice365Group -Site https://contoso.sharepoint.com/sites/classicsite -DisplayName "Classic Site" -Alias "classicsite" -KeepOldHomepage

Parameters

-Alias

Specifies the email alias for the new Microsoft 365 Group that will be created.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Online

-Classification

Specifies the classification value, if classifications are set for the organization. If no value is provided, the default classification will be set, if one is configured.

See Microsoft Entra cmdlets for configuring group settings and follow the steps in the Create settings at the directory level to define the classification for Office 365 groups.

See Manage Office 365 Groups with PowerShell for more information.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Online

-Description

Specifies the group's description.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Online

-DisplayName

Specifies the name of the new Microsoft 365 Group that will be created.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Online

-IsPublic

Determines the Microsoft 365 Group's privacy setting. If switch is included, the group will be public, otherwise it will be private.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Online

-KeepOldHomepage

For sites that already have a modern page set as homepage, you can specify whether you want to keep it as the homepage.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Online

-Site

The site collection being connected to new Office 365 Group.

Type:Microsoft.Online.SharePoint.PowerShell.SpoSitePipeBind
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False
Applies to:SharePoint Online