What
For SharePoint Online Site Collections, enabling anonymous (“anyone” or “guest”) links for a site collection is really straightforward in the “manage site collections” section of Office 365 Admin.
You know, this guy…
However, if you have created a new, fancy/fangled Office 365 Group to leverage Teams and other goodies inside your organization, you will have by now noticed that the Site Collections that power the underlying storage and plumbing are not available to be managed. We need another way to make this possible.
So What
First off, a few things to clarify here:
- We are not talking about private or public groups. Private/Public in Office 365 Groups determine whether the groups is “discoverable” within your organization. In other words, can someone, inside our company find the group and request to join, or not. It has nothing to do with externa guest file sharing.
- We are not talking about inviting external users to an Office 365 Group. While that is recently possible, the requirement/desire here is that:
- The organization can use the group internally as it is intended, complete with teams
- However, within the group, they want to share “some” files or folders with external guests/contributors rather than moving the files to another place, to collaborate
Now What
It’s not clear yet whether Microsoft plans to ever give us this ability on the surface (a few button clicks), though I suspect with demand/pressure, it is coming. There is lots of chatter in this uservoice, and it indicates “boom, it is done” but it isn’t clear what exactly is done: https://office365.uservoice.com/forums/286611-office-365-groups/suggestions/16365496-allow-anonymous-link-sharing-for-files-and-folders
Before
You may have found this blog post if:
- You get “Anyone” when you try to share files within the SharePoint site for an Office 365 Group and guest sharing isn’t enabled
- You see the message “Your organization is preventing you from selecting this option”
Frustrating. And not super clear how to deal with it (yet).
So for now, we have PowerShell…
- Connect to SharePoint Online using SharePoint Online Management Powershell (get it here: https://www.microsoft.com/en-ca/download/details.aspx?id=35588)
$adminUPN="replace_with_username"
$orgName="name_of_sharepoint_prefix"
$usercredential = Get-Credential -username $adminUPN -Message "type password"
Connect-SPOService -Url https://$orgName-admin.sharepoint.com -Credential $userCredential
- Identify and connect to the desired Site Collection
$siteurl="https://$orgName.sharepoint.com/sites/desired_site_collection"
- Enable External User and Guest Sharing on that chosen Site Collection
set-sposite -identity $Siteurl -sharingcapability ExternalUserAndGuestSharing
That's it. Now check your work (refresh the page/site collection).
After
And what a visitor sees (visiting your shared folder)
Once shared, a folder looks like any other SharePoint site that has external sharing on, for the guest contributor.
Thanks, this is exactly what i was after. Appreciate the post.
Hi Sean,
I’ve tried this on a collections that was an originally an Office365 Group but was later tied to a Microsoft Team. I get the following error: (domain name removed for privacy)
set-sposite : Value cannot be null.
Parameter name: password
At line:1 char:1
+ set-sposite -identity https://contoso.sharepoint.com/sites/ …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Set-SPOSite], ArgumentNullException
+ FullyQualifiedErrorId : System.ArgumentNullException,Microsoft.Online.SharePoint.PowerShell.SetSite
It appears it won’t let me change this setting where a password is not required to access the collection. Is this only possible with pure Office365 Groups and not with Team collections?
Thanks,
Joe
Never mind, you can delete my comment. My Powershell connections to O365 timed out and I hadn’t realized it logged me off. I haven’t had enough coffee today…
Thank you! Thank you! A thousand times thank you!
Office 365 tried valiantly, but to no avail. Your easy fix did the trick!
Cheers,
Stephen
Thanks so much for this, I’ve been tearing my little remaining hair out trying to figure out how to share just a few subfolders to an external customer without giving them the keys to our entire group site. Perfect solution.
Love it!
Thanks!
You Legend!! So glad you posted this Gold nugget for other mortals who are at the mercy of Giant providers rushing out half solutions!
Thank you for posting this guide, Very helpful and solved the issue for me.
Nice! But what if I would like to see this behaviour on every newly created Office 365 Group?
I think it should be possible using the SET-SPOTenate command but I haven’t figured it out yet.
At this moment I’m running a PowerShell-script every night that checks for new Groups and adds the ‘set-sposite -identity $Siteurl -sharingcapability ExternalUserAndGuestSharing’ command to all files older then one day.
For all of you that need this script (credits to the Original poster of this script, it’s not mine):
$lastXdays = 1 (# Groups created on or after today – $lastXdays will be updated)
$Groups = Get-UnifiedGroup -ResultSize unlimited | Where-Object {$_.SharePointSiteUrl -ne $null} | Where-Object {$_.WhenCreated -ge ((Get-Date).AddDays(-$lastXdays))}
foreach($siteURL in $Groups.SharePointSiteUrl) { set-sposite -identity $siteURL -SharingCapability ExternalUserAndGuestSharing }
The first time I’ve changed the @lastdays to 1000 and runned the script. This way every file older then 1000 days is modified so it took a while.
If anyone knows how to acomplish this in a more elegant way: please reply to this post 🙂
Excellent! Worked exactly as expected, probably saved me countless hours of hair-pulling to hit a brick wall 🙂
Thank you! You are my new personal hero.
Thanks dude, worked like a charm!
This setting is now available in the new (preview) sharepoint admin portal (https://xxxxxxx-admin.sharepoint.com). Select the individual site, and adjust “Sharing Status” as required.
Thank you for posting this! I was able to share with external users.
Thanks for the post.
However, the option for sharing with anyone is still deactivated and I am still getting the message that the organization is preventing this option. Does anyone have anything else to add that I can check or try?
Thanks again.
THANK YOU!
My integration with a third party project management tool would not work. I changed the sharing settings and permissions at site level and tried a few other things, but this worked a treat!