Monday, 17 February 2020

SP Online - Handling external sharing using power shell



//Get all site collection
$SiteColl = Get-SPOSite  -Limit ALL

//Disable external sharing for all the site/site collection in the tenant
foreach($Site in $SiteColl)
{
    Write-host $Site.Url
    Set-SPOSite -Identity $Site.Url -SharingCapability Disabled
}


//Disable external sharing
Set-SPOSite -Identity "https://xxxx.sharepoint.com/sites/xxx" -SharingCapability Disabled

//To get Detailed list of sp site
Get-SPOSite -Identity "https://xxxx/sites/xxx" -detailed |fl

No comments:

Post a Comment