Anonymous guest sharing in Teams part two.

In this article I will show you how to allow anonymous sharing of folders and documents from Teams created by School Data Sync. This article will only cover the actual SharePoint permissions, for more information about sharing please read my initial post Anonymous guest sharing in Teams.

From the Docs we can learn that School Data Sync (SDS) is a free service in Office 365 for Education that reads the school and roster data from a school’s Student Information System (SIS). It creates Office 365 Groups for Exchange Online and SharePoint Online, class teams for Microsoft Teams and OneNote Class notebooks among other things.

Large schools and districts can save a lot of time using School Data Sync to automate the creation of teams, user accounts, teams membership, licensing etc. Just imagine creating class teams and adding memberships in a district with thousands of students and teachers, then imagine repeating that during every summer break… SDS can be a complex tool, luckily Microsoft also offer free one-to-one deployment support.

As I explained in the first part of this two part part series, default SharingCapability of the underlying SharePoint site is ExternalUserSharingOnly, not ExternalUserAndGuestSharing which is what is needed for anonymous sharing (sharing with users without an Azure AD account).

As previously shown we can easily change the SharingCapability of a single site, but to change in bulk all those created with School Data Sync, based on data from your Student Information System, we need to create a simple PowerShell script.

First up we need to save our admin credentials to a variable and connect to SharePoint Online PowerShell:


$Cred = Get-Credential

Connect-SPOService -Url https://tenantname-admin.sharepoint.com -Credential $Cred

Now we need to find all the SharePoint sites belonging to teams created by School Data Sync, first lets capture all sites in a variable:


$sites = Get-SPOSite -Limit All

School Data Sync will create teams based on what Microsoft refer to as Sections. A section could be a class, course or some other type of logical group in your SIS, and it will allways have a unique identifier that will be part of the URL of the underlying Sharepoint site. It would typically look like this:

https://tenantname.sharepoint.com/sites/Section_131408225065301513

At this point we have a variable containing all SharePoint sites, lets separate out those belonging to a team created by School Data Sync by filtering on the URL with a pipe to Where-Object:


$SDSSites = $sites | ? {$_.Url -like "https://tenantname.sharepoint.com/sites/Section_*" }

You can easily establish the total amount of SharePoint sites created by School Data Sync using the Count method.


$SDSSites.Count

Now that we have a variable containing the relevant SharePoint site objects, let’s summarize this whole excercise into a script to allow anonymous sharing in bulk:

# store admin credentials in a variable
$Cred = Get-Credential

# Connect to SharePoint Online PowerShell
Connect-SPOService -Url https://tenantname-admin.sharepoint.com -Credential $Cred

# store all SharePoint sites in a variable
$sites = Get-SPOSite -Limit All

# extract SharePoint sites created by SDS
$SDSSites = $sites | ? {$_.Url -like "https://tenantname.sharepoint.com/sites/Section_*" }

# set SharingCapability to ExternalUserAndGuestSharing

foreach($site in $SDSSites){

Set-SPOSite -Identity $site.Url -SharingCapability ExternalUserAndGuestSharing

}

Set-SPOSite is quite slow, depending on how many teams were created by SDS, this script can take hours to finish. Consider adding a progress counter using Write-Progress if $SDSSites.Count returns more than 100 sites.

When the script is finished you should be able to share anonymously from all teams created by SDS. Remember to repeat the process whenever new teams are added via your SIS (typically during winter and/or summer break).

1 thought on “Anonymous guest sharing in Teams part two.

  1. Pingback: Parent access in Microsoft Teams for Education | Teams.rocks

Leave a comment