Open SharePoint Online Management Shell

Connect to your SharePoint Online site with your administrator access account
PS C:\Windows\system32> Connect-SPOService https://lcpsorg-admin.sharepoint.com
Get list of groups. (Note: Some idiots panic unnecessarily when they don’t see the list of group names in the powershell window and see errors instead. Don’t be like those idiots and just verify that you specified URL of ‘site collection‘ and NOT the URL for the site. Thanks, The idiot.)
PS C:\Windows\system32> Get-SPOSiteGroup -Site https://lcpsorg.sharepoint.com/sites/forms
What I wanted to do now is to get create a New SharePoint Online group in the site collection and set the permission for the group to ‘Approve‘
Setup script for new group:
PS C:\scripts\PowerShell Scripts> New-SPOSiteGroup -Site https://xyz.sharepoint.com/sites/abc-Group “User Id Approval Group” -PermissionLevels “Approve”
Adding user to the group:
PS C:\scripts\PowerShell Scripts> Add-SPOUser -Site https://lcpsorg.sharepoint.com/sites/forms -LoginName joe.healy@contoso.com -Group “User Id Approval Group”
Verify that group is actually created and user added to group:
PS C:\scripts\PowerShell Scripts> Get-SPOSiteGroup -Site https://xyz.sharpeoint.com/sites/abc-Group “User Id Approval Group”
This would then display the group with its attributes. For lack of time am gonna stop here. But there are ways to automate the process by scripting functions that would iterate through groups and get names from a CSV file
References:
Pluralsight course – #Powershell for #Office 365
Discover more from QubitSage Chronicles
Subscribe to get the latest posts sent to your email.