Einstellungen zum Teilen von SharePoint Sites über PowerShell anpassen

Welche Personen Inhalte auf einer SharePoint Seite teilen dürfen, kann in den Site Sharing Settings angepasst werden. Die Konfigurationen sind auch über PowerShell möglich.

In den Berechtigungen einer SharePoint Seite können Besitzer über 3 Möglichkeiten angeben welche Personen Inhalte teilen dürfen. In der Standardkonfiguration dürfen alle Mitglieder Inhalte teilen.

Standardkonfiguration

Eine Standardkonfiguration für den SharePoint Tenant gibt es aktuell nicht. Die Konfiguration kann aber pro SharePoint Seite über PowerShell gesetzt werden. Es funktioniert sowohl mit dem SharePoint Online PowerShell Modul als auch über PnP.PowerShell, wobei PnP.PowerShell flexibler ist (siehe Option 2).

SharePoint Online PowerShell Modul
  1. Installiere/Aktualisiere das SharePoint Online PowerShell Modul.
  2. Verbinde dich über Connect-SPOService zu deinem SharePoint Tenant.
  3. Mit Set-SPOSite kannst du die Konfiguration auf “Only site owners can share files, folders, and the site” setzen. Die mittlere Option steht mit dem SharePoint Online PowerShell Modul nicht zur Verfügung.
Set-SPOSite <SiteUrl> -DisableSharingForNonOwners

PnP.PowerShell – Option 1
  1. Installiere/Aktualisiere das PnP.PowerShell Modul.
  2. Verbinde dich mit Connect-PnPOnline zu deinem SharePoint Tenant.
Connect-PnPOnline -Url https://<Tenantname>-admin.sharepoint.com -Interactive
  1. Mit Set-PnPTenantSite kannst du die Konfiguration auf “Only site owners can share files, folders, and the site” setzen. Die mittlere Option steht mit der Variante nicht zur Verfügung.
Set-PnPTenantSite -Identity <SiteUrl> -DisableSharingForNonOwners

PnP.PowerShell – Option 2

Für Option 2 muss die Anpassung per PnP.PowerShell über das RootWeb der SharePoint Seite erfolgen, statt über die Admin Center URL.

  1. Installiere/Aktualisiere das PnP.PowerShell Modul.
  2. Verbinde dich mit Connect-PnPOnline zu deiner SharePoint Seite.
Connect-PnPOnline -Url <SharePointSiteUrl> -Interactive
  1. Lade das RootWeb der Seite.
$Web = Get-PnPWeb -Includes MembersCanShare,AssociatedMemberGroup.AllowMembersEditMembership
  1. Über das RootWeb sind alle 3 Optionen konfigurierbar.

Site owners and members, and people with Edit permissions can share files and folders, but only site owners can share the site.


Only site owners can share files, folders, and the site.


Standardkonfiguration zurücksetzen
Site owners and members can share files, folders, and the site. People with Edit permissions can share files and folders.

Nice to know
Für jemanden der SharePoint im Classic Design kennt. Die Site Sharing Settings sind weiterhin im Classic Design verfügbar. Man öffnet die gewünschte SharePoint Seite über <SiteUrl>/_layouts/15/user.aspx und wählt die Konfiguration für Access Request Settings. Die zwei oberen Optionen sind die Konfigurationen für Site Sharing Settings, statt im Modern Design im Classic Design.

Site Sharing Settings in SharePoint Classic
Share
Avatar photo

Tobias Asböck

Tobias is a Senior System Engineer with more than 10 years of professional experience with Microsoft 365 products such as SharePoint Online, SharePoint Premium, OneDrive for Business, Teams Collaboration, Entra ID, Information Protection, Universal Print, and Microsoft 365 Licensing. He also has 15+ years of experience planning, administering, and operating SharePoint Server environments. Tobias is a PowerShell Scripter with certifications for Microsoft 365 products. In his spare time, Tobias is busy with updates in the Microsoft 365 world or on the road with his road bike and other sports activities. If you have additional questions, please contact me via LinkedIn or [email protected].

Leave a Reply

Your email address will not be published. Required fields are marked *