Skip to content

Set-SiteOffice365Group

SharePoint Online: Connects a site collection to an Office 365 Group

#Requires -Version 5.1
#Requires -Modules Microsoft.Online.SharePoint.PowerShell

[CmdletBinding()]
Param(
    [Parameter(Mandatory = $true)]
    [string]$Site,
    [Parameter(Mandatory = $true)]
    [string]$DisplayName,
    [Parameter(Mandatory = $true)]
    [string]$Alias,
    [string]$Classification,
    [string]$Description,
    [switch]$IsPublic,
    [switch]$KeepOldHomepage
)

Process {
    try {
        $cmdArgs = @{ ErrorAction = 'Stop'; Site = $Site; DisplayName = $DisplayName; Alias = $Alias; IsPublic = $IsPublic; KeepOldHomepage = $KeepOldHomepage }
        if ($PSBoundParameters.ContainsKey('Classification')) { $cmdArgs.Add('Classification', $Classification) }
        if ($PSBoundParameters.ContainsKey('Description')) { $cmdArgs.Add('Description', $Description) }
        $result = Set-SPOSiteOffice365Group @cmdArgs | Select-Object *
        if ($null -ne $result) { foreach ($item in $result) { $item | Add-Member -NotePropertyName Timestamp -NotePropertyValue (Get-Date -Format "yyyy-MM-dd HH:mm:ss") -PassThru -Force } }
    }
    catch { throw }
}

The site collection to connect to an Office 365 Group

Name of the new Office 365 Group

Email alias for the new Office 365 Group

Classification value for the group

Description of the group

Off

Determines the group privacy setting (public if specified)

Off

Keep the existing modern page as homepage

An interactive directory of PowerShell scripts.