Share Sharepoint files and folders from a Office365 Group

Sharing files in Sharepoint, that shouldn’t be that hard right? Well if you are using Office 365 Groups you might have noticed that you are not able the share a file or folder from the Groups Sharepoint site to external users. When you try to use the Invite People option you will get the following error:

Your organization policies do not allow you to share with these users

Or if you share a link, the users get an error that he or she is not listed in the directory of the tenant.

Howto enable external user sharing?

You will have to use PowerShell to enable the sharing with external users.

  1. First you need to install the Sharepoint Online Management Shell .
  2. Open Powershell and run the following commandlet to connect to the Sharepoint Online Administration Center  (make sure you add the -admin part to the url)
    Connect-SPOService -url https://contoso-admin.sharepoint.com -credential [email protected]
    
  3. Run the following command to change the sharing options for the SharePoint site
    Set-SPOSite -identity https://contoso.sharepoint.com/teams/site1 -SharingCapability ExternalUserAndGuestSharing

 

Changing multiple sites at once

If you already have multiple sites running you might want to change them all at once. First we get a list of the sites where the sharing capability is set in correctly:

Get-SPOSite | select Title, Url, SharingCapability | where {$_.SharingCapability -ne 'ExternalUserAndGuestSharing'}

You should not change all the sites at once without checking them first. So we store all the sites and loop trough them asking a confirmation to change it. This way you are sure that not a private site is set open to sharing.

$sites = Get-SPOSite | select title, Url, SharingCapability | where {$_.SharingCapability -ne 'ExternalUserAndGuestSharing'}

ForEach ($s in $sites)
{
    Write-host $s.title " is set to " $s.sharingCapability
    $r = Read-Host 'Change to External and Guest user? y/n'

    if($r -eq 'y')
    {
        Set-SPOSite -identity $s.Url -SharingCapability ExternalUserAndGuestSharing
    }
}

 

You can find more information about the Set-SPOSite options here https://technet.microsoft.com/en-us/library/fp161394.aspx

Get more stuff like this

IT, Office365, Smart Home, PowerShell and Blogging Tips

I hate spam to, so you can unsubscribe at any time.

1 thought on “Share Sharepoint files and folders from a Office365 Group”

Leave a Comment