Weboldal keresés

SharePoint Online: Állítsa a „Ki tekintheti meg a csoporttagságot” beállítást Mindenkinek a PowerShell használatával


Követelmény: Állítsa be, hogy Ki tekintheti meg a csoporttagságot mindenkire.

Hogyan állíthatja be, hogy ki tekintse meg a csoporttagságot mindenkire a SharePoint Online-ban?

Alapértelmezés szerint a SharePointban mindenki megtekintheti az adott csoport tagságát. Előfordulhat azonban, hogy a csoportbeállításokat úgy szeretné beállítani, hogy csak a csoport tagjai lássák azokat a felhasználókat, akik jogosultak a csoport kezelésére. Másrészt érdemes megnyitni a csoporttagságot, hogy mindenki számára elérhető legyen. Tehát a konkrét engedélyek követelményeitől függően megadhatja a csoportbeállításokat.

Kövesse az alábbi lépéseket annak módosításához, hogy ki tekintheti meg a csoporttagságot a SharePoint Online-ban:

  1. Nyissa meg a Webhelybeállítások >> Emberek és csoportok menüpontot
  2. Válassza ki azt a SharePoint Online-csoportot, amelynek a csoporttagsági nézet beállításait módosítani szeretné
  3. A csoport oldalon kattintson a Beállítások >> Csoportbeállítások elemre
  4. A "Csoportbeállítások" alatt állítsa be a "Ki láthatja a csoport tagságát?" mindenkinek". A módosítások mentéséhez nyomja meg az OK gombot.

A PowerShell a Csoporttagság nézet Mindenki értékre állításához:


#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 Variables
$SiteURL="https://Crescent.sharepoint.com/"
$GroupName="Team Site Members"

Try {
    $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
    $Group = $Ctx.web.SiteGroups.GetByName($GroupName)
    $Ctx.Load($Group)
    $Ctx.ExecuteQuery()

    #Set Group settings: Who can view the membership of the group? Everyone 
    $Group.OnlyAllowMembersViewMembership = $False
    $Group.Update()
    $Ctx.ExecuteQuery()

    Write-host "Group Settings Updated" -ForegroundColor Green  
}
Catch {
    write-host -f Red "Error Updating Group Settings!" $_.Exception.Message
}

A PowerShell a SharePoint Online összes csoportjában a Csoporttagság nézet nézetet Mindenkire állítja:


#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 Variables
$SiteURL="https://Crescent.sharepoint.com/sites/marketing"

Try {
    $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 all groups of the site
    $Groups = $Ctx.Web.SiteGroups
    $Ctx.load($Groups)
    $Ctx.ExecuteQuery()
    
    #Iterate through each Group - Exclude SharePoint Online System Groups!
    ForEach($Group in $Groups| Where {$_.OwnerTitle -ne "System Account"})
    {
        #Set Group settings: Who can view the membership of the group? Everyone 
        $Group.OnlyAllowMembersViewMembership = $False
        $Group.Update()
        $Ctx.ExecuteQuery()

        Write-host "Group Settings Updated for $($Group.Title)" -ForegroundColor Green  
    }
}
Catch {
    write-host -f Red "Error Updating Group Settings!" $_.Exception.Message
}

PnP PowerShell a csoportbeállítások módosításához


#Parameters
$SiteURL = "https://crescent.sharepoint.com/sites/Retail"
$GroupName = "Retail Members"

#Connec tot SharePoint Online
Connect-PnPOnline -URL $SiteURL -Interactive

#Change Group Settings
Set-PnPGroup -Identity $GroupName -OnlyAllowMembersViewMembership:$false

Kapcsolódó cikkek