SharePoint Online: cambiar el propietario del grupo mediante PowerShell
Los grupos de SharePoint simplifican la administración de permisos al asignar un conjunto de usuarios a un grupo y asignarles permisos a través del grupo. Cuando creamos un sitio, el grupo Propietario predeterminado del sitio (por ejemplo, en el sitio de “Marketing”, sus “Propietarios de Marketing”) se asigna como propietario del grupo para todos los grupos. Si alguien crea un grupo personalizado, el creador será designado propietario del grupo.
¿Cómo cambiar el propietario del grupo en SharePoint Online?
Si es el administrador de un sitio de SharePoint Online y necesita cambiar el propietario del grupo, deberá seguir algunos pasos. En esta publicación de blog, lo guiaremos a través del proceso de cambiar el propietario del grupo en SharePoint Online. Este puede ser un proceso útil si necesita transferir la propiedad de un grupo a otro usuario.
Siga estos pasos para cambiar el propietario de un grupo en SharePoint Online:
- Vaya a Configuración del sitio >> Permisos del sitio >> Personas y grupos.
- Elija el grupo cuyo propietario desea cambiar en la navegación izquierda.
- Desde la página del grupo, haga clic en Configuración >> Configuración del grupo.
Ingrese el nuevo propietario del grupo en el campo "Propietario del grupo". Presione Aceptar para guardar los cambios. Esto cambia el propietario de un grupo de SharePoint Online.
Establecer propietario del grupo mediante el Shell de administración de SharePoint Online:
Puede usar el Shell de administración de SharePoint Online para establecer el propietario de un grupo de SharePoint Online.
#Parameters
$AdminSiteURL="https://crescent-admin.sharepoint.com"
$SiteURL="https://crescent.sharepoint.com"
$GroupName="Team Site Members"
$OwnerName="Salaudeen@crescent.com"
#Get Credentials to connect to SharePoint Admin Center
$Cred = Get-Credential
#Connect to SharePoint Online Admin Center
Connect-SPOService -Url $AdminSiteURL -credential $Cred
#sharepoint online change group owner powershell
Set-SPOSiteGroup -Site $SiteURL -Identity $GroupName -Owner $OwnerName
PowerShell para cambiar el propietario del grupo en SharePoint Online:
A continuación se explica cómo configurar el propietario del grupo de SharePoint Online mediante PowerShell CSOM.
#Load SharePoint CSOM Assemblies
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll"
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"
#Config Parameters
$SiteURL= "https://crescent.sharepoint.com"
$GroupName="Team Site Members"
$GroupOwnerName="Salaudeen@crescent.com"
#$GroupOwnerName="Team Site Owners"
#Setup Credentials to connect
$Cred = Get-Credential
$Cred = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.UserName,$Cred.Password)
Try {
#Setup the context
$Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)
$Ctx.Credentials = $Cred
#Get the Group owner - Can be an another Group or User Account
#$GroupOwner = $Ctx.Web.SiteGroups.GetByName($GroupOwnerName)
$GroupOwner = $Ctx.Web.EnsureUser($GroupOwnerName)
#Get the Group
$Group = $Ctx.Web.SiteGroups.GetByName($GroupName)
#Set the Group Owner
$Group.Owner = $GroupOwner
$Group.Update()
$Ctx.ExecuteQuery()
Write-host -f Green "Group Owner has been Updated!"
}
Catch {
write-host -f Red "Error changing Group Owner!" $_.Exception.Message
}
PowerShell para cambiar el propietario del grupo para todos los grupos en SharePoint Online:
Cambiemos el propietario del grupo para todos los grupos de la colección de sitios de SharePoint Online.
#Load SharePoint CSOM Assemblies
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll"
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"
#Config Parameters
$SiteURL= "https://crescent.sharepoint.com"
$GroupOwnerName="Team Site Owners"
#Setup Credentials to connect
$Cred = Get-Credential
$Cred = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.UserName,$Cred.Password)
Try {
#Setup the context
$Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)
$Ctx.Credentials = $Cred
#Get the Group owner - Can be an another Group or User Account
$GroupOwner = $Ctx.Web.SiteGroups.GetByName($GroupOwnerName)
#Get All Groups of the Site
$GroupsColl = $Ctx.web.SiteGroups
$Ctx.Load($GroupsColl)
$Ctx.ExecuteQuery()
#Iterate through each Group - Exclude SharePoint Online System Groups!
ForEach($Group in $GroupsColl | Where {$_.OwnerTitle -ne "System Account"})
{
Write-Host -f Yellow "Changing the Owner of the Group:", $Group.Title
#sharepoint online powershell set group owner
$Group.Owner = $GroupOwner
$Group.Update()
$Ctx.ExecuteQuery()
}
Write-host -f Green "All Group Owners are Updated!"
}
Catch {
write-host -f Red "Error changing Group Owners!" $_.Exception.Message
}
Aquí hay otra publicación para SharePoint local: ¿Cómo cambiar el propietario del grupo en SharePoint usando PowerShell?
SharePoint Online: cambiar el propietario del grupo mediante PnP PowerShell
Para configurar el propietario del grupo para un grupo de SharePoint Online, use este cmdlet PnP PowerShell Set-PnPGroup:
#Config Variables
$SiteURL = "https://Crescent.sharepoint.com/Sales"
$GroupName="Sales Portal Members"
#Group owner variable: Can be existing group or user account Email
$GroupOwner = "Sales Portal Owners" #or Salaudeen@Crescent.com
#Connect PnP Online
Connect-PnPOnline -Url $SiteURL -Interactive
#Set Group Owner
Set-PnPGroup -Identity $GroupName -Owner $GroupOwner
Para cambiar el propietario del sitio en SharePoint Online, utilice: ¿Cómo cambiar el propietario del sitio de SharePoint Online usando PowerShell?
