Two of the most common questions I’ve been asked when engaged with a financial or government organization for a Office 365 deployment, which involves Microsoft Teams and OneDrive is whether it was possible to disable file sharing within teams and/or disabling OneDrive. What’s complicated about this is that Teams integrates with SharePoint Online and therefore is very different than what administrators are used to when working with the older Skype for Business, Lync Server and Office Communications Server. OneDrive is also integrated with SharePoint Online. Given that this appears to be asked frequently and I had reached out to Microsoft support for an official answer, I thought I’d write this short blog post about:
- Disabling Teams File Sharing (1 method)
- Disabling OneDrive (2 methods)
Disabling Teams File Sharing
Microsoft Teams uses SharePoint Online for file transfers and storage and therefore removing the SharePoint license from users would prevent them from sharing files. This obviously has the consequence of removing SharePoint Online functionality all together so this may or may not be viable if it is needed. The following is an example of removing the feature for a user who is licensed for E1 or E3:
Open the license properties of the account for the user:
Scroll all the way to the bottom of the licenses until you see the Apps section then click on the downward carrot to expand the list:
Locate the item SharePoint Online (Plan 2) and uncheck it:
Disabling SharePoint will also disable the user’s ability to use SharePoint Online.
Disabling OneDrive
There are 2 ways to disable OneDrive. The first option is to repeat the same procedure as above with Teams.
The second option, which is a bit more complicated is to remove the ability to create OneDrive sites, along with removing any existing sites through the use of PowerShell.
Begin by removing ability to create a site for everyone. Navigate from the admin center then click on SharePoint admin center:
Click on User Profiles:
Click on Manage User Permissions:
Remove the permissions currently configured that allows users to create My Sites:
The above will prevent new users from creating a MySite which is the storage repository of OneDrive.
For users who already have used OneDrive and therefore created a MySite repository, we’ll need to use PowerShell to remove their created MySite.
Connect to SharePoint Online with PowerShell via the following commands in this document: https://docs.microsoft.com/en-us/powershell/sharepoint/sharepoint-online/connect-sharepoint-online?view=sharepoint-ps
Remove the MySite page with PowerShell via the following commands in this document: https://docs.microsoft.com/en-us/powershell/module/sharepoint-online/remove-sposite?view=sharepoint-ps
The command above will require you to enter the URL of the MySite page of the user who has OneDrive access and to determine the URL, navigate to the user’s account properties in the Microsoft 365 admin center, the OneDrive menu and then click on Create link to files to generate the URL to this user account’s MySite page:
The action will create a URL for you to copy and paste into the command to remove the MySite page:
Remove-SPOSite -Identity https://44-my.sharepoint.com/personal/tluk -NoWait
The second option is a bit of a manual process but if there a lot of user accounts then it would be worthwhile to create a script that will traverse through each account and export the link rather than manually doing so from the GUI.