Sharing files with external guest is a native SharePoint feature.Teams relays on Office 365 Groups. Any O365 Group can be used and is required for activating a MS Teams.
Therefore the basic settings once a Teams was created, which automatically creates an Office 365 has external non-teams-guest sharing disabled by default.
The structure for external file sharing is:
1. Organizational Setting (Tenant Level)
Admin centers > SharePoint/sharing
We need now managing external sharing for Office 365 Group site collections.
Set-SPOSite -Identity https://tenant.sharepoint.com/sites/site1 -SharingCapability SharingOption
$userCredential = Get-Credential
Connect-SPOService -Url https://TenantName-admin.sharepoint.com -Credential $userCredential
$sites = Get-sposite -template GROUP#0 -includepersonalsite:$false
Foreach($site in $sites)
Set-SPOSite -Identity $site.Url -SharingCapability SharingOption
Variables:Write-Host("External Sharing Capability updated for all sites.")
- TenantName - The name of your Office 365 tenant.
- SharingOption - The sharing option that you want to use, from the table above.
|Disabled||External user sharing (share by email) and guest link sharing are both disabled.|
|ExternalUserSharingOnly||External user sharing (share by email) is enabled, but guest link sharing is disabled.|
|ExternalUserAndGuestSharing||External user sharing (share by email) and guest link sharing are both enabled. This is the default setting.|
|ExistingExternalUserSharingOnly||External user sharing (share by email) is available only for external users that are already in the directory.|