I had an issue where when I tried to share my SharePoint Online Communication Site with an external user, I received an error:
Your organization’s policies don’t allow you to share with these users. Go to External Sharing in the Office 365 admin center to enable it.
But when I went to my O365 tenant, sharing was enabled:
Allow users to invite and share with authenticated external users
Allow sharing to authenticated external users and using anonymous access links
The issue is that sharing is disabled on the site, so we need to use PowerShell to fix this.
As a SPO tenant admin, open PowerShell and do Connect-SPOService, then enter your tenant-admin.sharepoint.com URL. Supply your global admin credentials.
Then run get-sposite with your site.sharepoint.com URL, but pipe (|) the results to format-list (fl) with the property attribute looking for shar (for sharing)
Get-SPOSite https://tenant.sharepoint.com/sites/Extranet | fl -prop *shar*
SharingCapability : Disabled
SiteDefinedSharingCapability : Disabled
DisableCompanyWideSharingLinks : NotDisabled
SharingDomainRestrictionMode : None
So set the sharing to 1 (ExtenlaUserSharingOnly)
set-SPOSite https://tenant.sharepoint.com/sites/Extranet –SharingCapability 1
Refresh the page you want to share and now the external user invite is allowed.
Done! Now you are able to share a modern SharePoint Online site with guest users. A better approach I use is to create a group and share with external users, that way security and content are isolated from employee content.