Manage external sharing for SharePoint Online

I've recently been trying to share files and folders with external users from within my Office 365 tenant and have been having issues.  Although the GUI was configured as per Microsoft's best practices I was still unable to share anything externally and was receiving the "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" error message.

In order to resolve it I resorted to PowerShell! :)

Configure SharePoint Online External Sharing with PowerShell

The first thing that you need to do is download the SharePoint Online Management Shell from - https://www.microsoft.com/en-ca/download/confirmation.aspx?id=35588 Once you've installed module launch it as administrator.  Within your PowerShell session issue the following commands, replacing your information as necessary.

    $username = "admin@yourorg.com"
    $password = "password"
    $cred = New-Object -TypeName System.Management.Automation.PSCredential -argumentlist $userName, $(convertto-securestring $Password -asplaintext -force)
    Connect-SPOService -Url https://yourorg-admin.sharepoint.com/ -Credential $cred

The above connects you to your SharePoint online area. Now that you are connected you can query your SharePoint Online sites using the simple command:

    Get-SPOSite

This command will help show you what your SharePoint Online URLs are, as below: From here you can now issue the command required to enable External Sharing for your chosen site/sites.   The command is:

    Set-SPOsite -identity https://yourorg.sharepoint.com -sharingcapability ExternalUserAndGuestSharing

Once completed this command gives you no feedback that it is completed successfully but once it has been issued you'll now be able to successfully share your files/folders with external users.

Happy sharing! I would love to hear your thoughts and experiences of External Sharing within SharePoint Online? Any pros and cons I should be aware of? Please follow me on Twitter @TechieLass for other news, and tips.