UPDATE (Jan 2019): Microsoft has made changes to the way that Microsoft Teams create Office 365 Groups - so they are no longer added to Outlook by default. This means, that if you are using this script, it might not add files that reside in a Team, to your OneDrive client. I varies from tenant to tenant, I have yet to discover why it works for some, and not others.
In this article, I will cover the bases on how I currently recommend moving department drives to Office 365. Thoughts will be shared at the end, and feedback welcomed. Finally, I will unveil a script I have created to automatically have a users OneDrive Desktop Client, populated with all available Office 365 Group Drives - that now live in SharePoint Online / Teams / Office 365 Groups / Unified Groups (Dear lord, please help people find this on google!).
N.B.: This is not a script that creates a drive letter, like the OneDriveMapper by Jos Lieben. Instead, this script saves you the hassel of having the user go click on the “sync” button on each document library in Sharepoint Online.
As many European companies face the consequences of GDPR, and what to do with their trusty old file shares - some choose to go with Office 365 as their new storage space for company files.
This will lead them to use either SharePoint Online Sites with Document Libraries or the newer Office 365 Groups, which are essentially SharePoint Document Libraries with added superpowers.
I recommend using the Office 365 Groups, and preferably bringing them to life through Microsoft Teams, as this gives them most functionality, and you won’t be crying later when you need that added functionality.
An added bonus of using Office 365 Groups, is that their functionality is available from a variety of devices. And you might already have department groups just ripe for conversion to Office 365 Groups, which will consolidate the work area for many types of departments - making things simpler, once users are on-boarded properly to this new way of working (But that’s a whole other article waiting to happen!).
The BEST thing about using Office 365 Groups for your department files, is that I have created a script that will get your users on-board with the new religion - a lot quicker!
Powershell and the Microsoft Graph API to the Rescue
Having looked high and low, I have not been able to find anyone who had even come close to fully Automating the mapping of Group Files in the OneDrive Client - So I took it upon myself to get to know the Graph API a little better.
The script that you are about to read has not been tested thoroughly, and is only able to map Unified Groups at the moment, though changes are fairly easy to make.
A great deal of work has gone into making the script modular and readable - and self explaining enough for most scripters to play with it.
You will need to created an App registration in Azure AD for the script to work so you should be familiar with that, if not the official docs explain it here.
There is a config section in the beginning, which should be the only place you need to mess around.
Once done, just execute the script as your user, and you should see it mapping up groups in your OneDrive client! That is, if you have configured the newest OneDrive client, and are running at least Windows 10 1709. OH you might also want to create some Office 365 groups if you don’t have any ;)
Please read on after the script…
Though not perfect, this script will (when run in the users context) map all Office 365 Groups that have been made available to the user.
A cleanup function would be nice for groups that have been left, but I wanted to leave something for later :) (Along with a script I am building to automate Azure AD App Registrations).
Although Microsoft has announced that Auto Mapping for Microsoft Teams Files will come Q4 2018, I am sure this script still has some use - at least for people wanting to get busy with the Graph API in the simplest way possible through Powershell.
As always, I hope you enjoyed the article and leave some positive feedback (It really helps to motivate me, to do more articles on Microsoft Cloud solutions and Powershell scripting).
To learn more about the Graph API, visit: