Scenario
SharePoint Online allows you to share your content with external parties – that is, if sharing is allowed on the tenant level as well as on the site collection level. But if you allow external sharing on the tenant level, how can you easily see for which site collection you have which kind of external sharing level enabled?
Code
Today’s script doesn’t make use of the PnP PowerShell cmdlets, but of the ‘standard’ Microsoft SharePoint Online Management Shell. You connect to your tenant, verify first if sharing is enabled generally, and if so, exports a list of all site collections together with their sharing level (Disabled, Authenticated External Users, Authenticated External Users and Anonymous Users, Existing External Users only) to a CSV file.
$cred = Get-Credential Connect-SPOService -Url https://mytenant-admin.sharepoint.com -Credential $cred $tenant = Get-SPOTenant if($tenant.SharingCapability -eq "Disabled") { Write-Host "External Sharing is not enabled on this tenant" -ForegroundColor Red } else { #External Sharing is enabled. We'll fetch the details for all sites in the tenant Get-SPOSite -Limit All | select Url, SharingCapability | Export-Csv externalsharingreport.csv }
Note, the list of site collections does not include any OneDrive for Business sites. At the moment, simply refer to the mytenant-my.sharepoint.com site collection to see what kind of external sharing is enabled for OneDrive sites.
Office 365 Advent Calendar – 12 Get External Sharing Details for SharePoint Online Sites https://t.co/fctY7JBeri #office365adventcalendar
RT @modery: Office 365 Advent Calendar – 12 Get External Sharing Details for SharePoint Online Sites https://t.co/fctY7JBeri #office365adve…