当前位置:网站首页 > 更多 > 玩电脑 > 正文

[玩转系统] 如何更改 SharePoint Online 中的组名称?

作者:精品下载站 日期:2024-12-14 14:53:20 浏览:13 分类:玩电脑

如何更改 SharePoint Online 中的组名称?


要求:更改 SharePoint Online 中的组名称。

SharePoint Online:更改组名称

您是否曾经需要更改 SharePoint Online 中的组名称?您需要更新 SharePoint 组的名称,以更好地反映其目的或成员资格。这篇博文将引导您完成进行此更改所需的步骤。我们还将提供一些 PowerShell 脚本来更改 SharePoint Online 中的组名称。

要重命名 SharePoint Online 用户组:

  1. 导航到该组所在的站点 >> 单击屏幕右上角的齿轮图标,然后从下拉菜单中选择“站点设置”。
  2. 单击“站点权限”>> 从可用组列表中找到要重命名的组,然后单击其名称以打开组详细信息页面。
  3. 在群组页面上,单击“设置”菜单中的“群组设置”。

    [玩转系统] 如何更改 SharePoint Online 中的组名称?

  4. 为您的 SharePoint Online 组提供名称。如果需要,您还可以修改组的描述。完成更改后,单击“保存”以应用更改。

    [玩转系统] 如何更改 SharePoint Online 中的组名称?

  5. 单击“确定”保存更改。

使用 PowerShell 在 SharePoint Online 中重命名组

您还可以使用 PowerShell 重命名 SharePoint 组。下面是我的 PowerShell 脚本,用于重命名 SharePoint Online 中的组。


#Load SharePoint CSOM Assemblies
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\ISAPI\Microsoft.SharePoint.Client.dll"
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"

#Function to Rename a Group
Function Rename-SPOGroup([String]$SiteURL, [String]$OldGroupName,[String]$NewGroupName)
{
    Try {
        #Get credentials to connect
        $Cred= Get-Credential
        $Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.Username, $Cred.Password)
 
        #Setup the context
        $Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)
        $Ctx.Credentials = $Credentials

        #Get the Group by name
        $Group=$Ctx.web.SiteGroups.GetByName($OldGroupName)

        If($Group -ne $Null)
        {
            #Rename the group
            $Group.Title = $NewGroupName
            $Group.Update()
            $Ctx.ExecuteQuery()

            write-host -f Green "Group '$OldGroupName' Renamed to '$NewGroupName' Successfully!" $_.Exception.Message
        }
    }
    catch {
        write-host "Error Renaming Group: $($_.Exception.Message)" -foregroundcolor Red
    }
}

#Variables
$SiteURL="https://Crescent.sharepoint.com/"
$OldGroupName = "Team Site Members"
$NewGroupName = "Marketing Managers"

#Call the function
Rename-SPOGroup -SiteURL $SiteURL -OldGroupName $OldGroupName -NewGroupName $NewGroupName

PnP PowerShell 在 SharePoint Online 中更改组名称:

若要重命名 SharePoint Online 组,请使用 PnP PowerShell 中的 Set-PnPGroup cmdlet。


#Config Variables
$SiteURL = "https://Crescent.sharepoint.com/Sales"
$GroupName= "Sales Portal Members"
$NewGroupName ="Sales Managers"

#Connect PnP Online
Connect-PnPOnline -Url $SiteURL -Credentials (Get-Credential)

#Update the Group Name
Set-PnPGroup -Identity $GroupName -Title $NewGroupName

通过执行这些步骤,您可以轻松更新 SharePoint Online 中的组名称,并确保您的团队成员可以找到并访问他们所需的资源。

您需要 登录账户 后才能发表评论

取消回复欢迎 发表评论:

关灯