I'm trying to set up a SharePoint group as a group owner:

Set-SPOSiteGroup -Site https://sitecollection -Identity "Channel" -Owner "Music"

The error is:

Set-SPOSiteGroup : The specified user Music could not be found.
At line:1 char:1

How can I do it?

  • At least in some context it wasn't possible to add a group to own another group. It was somehow related to user permissions, so likely applicable to your case as well.
    – moe
    Jun 1 '17 at 11:44

You first need to get the SPOGroup and then pass it to the Set-SPOSiteGroup as below:

$ownerGroup = Get-SPOSiteGroup -Site "https://mytenant.sharepoint.com/sites/mysitecollection" -Group "Music"

Set-SPOSiteGroup -Site $siteUrl -Identity "Channel" -Owner $ownerGroup

Update - not really sure why its not working, but the below code is working for me. I have used CSOM with powershell to set the group owner.

$username = "username@tenantname.sharepoint.com" 
$password = "password" 
$url = "https://tenantname.sharepoint.com/sites/test"

$securePassword = ConvertTo-SecureString $Password -AsPlainText -Force 

# the path here may need to change if you used e.g. C:\Lib.. 
Add-Type -Path "c:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.dll" 
Add-Type -Path "c:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.Runtime.dll" 

# connect/authenticate to SharePoint Online and get ClientContext object.. 
$clientContext = New-Object Microsoft.SharePoint.Client.ClientContext($url) 
$credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($username, $securePassword) 
$clientContext.Credentials = $credentials 

$ownerGroup = $clientContext.Web.SiteGroups.GetByName("Music");

$visitorGroup = $clientContext.Web.SiteGroups.GetByName("Channel");
$visitorGroup.Owner = $ownerGroup;
#set group view membership
$visitorGroup.OnlyAllowMembersViewMembership = $false;
  • Hi, Thanks for the info but still not working.. I'm getting the error "Get-SPOSiteGroup : A parameter cannot be found that matches parameter name".. What should I change?
    – Peter Smp
    Jun 1 '17 at 11:24
  • @PeterSmp - my bad, there was error in syntax. It should be Get-SPOSiteGroup -Site, can you check code now ? Jun 1 '17 at 11:26
  • Now is different: Set-SPOSiteGroup : The specified user Microsoft.Online.SharePoint.PowerShell.SPOSiteGroup could not be found (I think he's expecting a user, not a group, probably)
    – Peter Smp
    Jun 1 '17 at 11:30
  • Can you check with updated answer ? Jun 1 '17 at 12:09
  • Thank's a lot! It is working now! do you know if there's a way to use CSOM with Powershell to specify the group settings for a group? "Who can view the membership of the group? "Group members of everyone" ?
    – Peter Smp
    Jun 1 '17 at 12:22

Hello Try this may be It will help you

            #Get the SPWeb
            $web = Get-SPWeb http://url_to_web

            #Get the Group
            $group = $web.SiteGroups["Group Name"]

            #Get the User 
            $user = $web.EnsureUser("domain\username")

            #Assign that user as the owner
            $group.Owner = $user

            #Update the Group
  • 1
    this is for sharepoint on prem, not online
    – Peter Smp
    Jun 1 '17 at 11:41
  • I have some question. Are you able to connect SharePoint Online using PowerShell? Jun 1 '17 at 11:46
  • Yes, I'm connected, I can execute the set-spositegroup by using a username instead of a group
    – Peter Smp
    Jun 1 '17 at 11:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.