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 = "firstname.lastname@example.org" $password = "YourPassword" $siteCollectionUrl = "https://yourorg.sharepoint.com" $siteAdminUrl = "https://yourorg-admin.sharepoint.com/" $securePassword = ConvertTo-SecureString $password –AsPlainText –force $O365Credential = New-Object System.Management.Automation.PsCredential($username, $securePassword)
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:
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.